Create a Real-Time preview of Flash CS3 component (5)

Source: Internet
Author: User
Create a Real-Time preview of Flash CS3 component (5)

Previous/next article 23:48:23/personal classification: Component

View (603)/comment (0)/score (0/0)

Create a Real-Time preview of Flash CS3 component (5)
Real-time preview is a major feature of the component. It allows users to intuitively understand the changes made by the component, which is quite easy to use.

1. A simple method for real-time Preview
The preview is a real-time preview file automatically generated by flash. You can use it directly when you change its name.

2. How to implement real-time Preview
A Real-time preview file is actually a SWF file containing components, but unlike a common file, its document class is fl. livepreview. livepreviewparent. when the Component Changes, flash will communicate with livepreviewparent, and then the livepreviewparent class will change the relevant attributes of the component.
According to the livepreviewparent class, we know that in real-time preview, if the component size changes, livepreviewparent will call the setsize method of the component to set the size, if there is no setsize method, set the width and height attributes directly. if the component parameters change, livepreviewparent directly assigns a value to the corresponding attribute.
Note the following two details:
First, real-time preview only responds to changes in size and component parameters, and all other attributes (Position, rotation, style...) are invalid for real-time preview.
Second, real-time preview directly assigns values to component parameters, rather than calling related methods.

3. Make a simple real-time Preview
Creating a simple SWF file is simple: Create a New FLA file and set the file class to FL. livepreview. livepreviewparent, drag the component to the scene, make sure that all the settings of the component are the default value, and finally release the component -- done!

4. Make a more advanced real-time Preview
In components, there are always some things that should not appear in real-time preview, such as the sub-item loaded by the accordion component. accurately speaking, all components, including icons and loaded files, should not appear in real-time preview. Otherwise, unknown problems may occur.
Therefore, you should use the checklivepreview (): Boolean method (inherited from uicomponent) in the component to check whether the component is in the real-time preview state.
For external components loaded, you can choose not to load them in real-time preview, or load a built-in component to replace them.
For example
If (checklivepreview ()){
// Insert the code for real-time preview here
}

5. Simplified Real-Time Preview
If you think real-time preview is too large, you can link the Real-Time preview to another class, which is a lite version that only implements the methods and attributes required for real-time preview. in this way, the component is separated from the real-time preview, which is easy to modify.
Real-time preview can streamline all attributes and Methods unrelated to component parameters, remove all listeners (events are not required in real-time Preview), and change styles to unchangeable, this simplifies the code.
For a Simplified Real-Time preview, see COM. cyjb. livepreview. livepreview_accordion.as in the attachment.

So far, the creation of Flash CS3 component series has come to an end, for the component of what problems, you can leave a message to me, or mail: f8cyjb@126.com

Final components and source files

 

Previous/next article 23:48:23/personal classification: Component

View (603)/comment (0)/score (0/0)

Create a Real-Time preview of Flash CS3 component (5)
Real-time preview is a major feature of the component. It allows users to intuitively understand the changes made by the component, which is quite easy to use.

1. A simple method for real-time Preview
The preview is a real-time preview file automatically generated by flash. You can use it directly when you change its name.

2. How to implement real-time Preview
A Real-time preview file is actually a SWF file containing components, but unlike a common file, its document class is fl. livepreview. livepreviewparent. when the Component Changes, flash will communicate with livepreviewparent, and then the livepreviewparent class will change the relevant attributes of the component.
According to the livepreviewparent class, we know that in real-time preview, if the component size changes, livepreviewparent will call the setsize method of the component to set the size, if there is no setsize method, set the width and height attributes directly. if the component parameters change, livepreviewparent directly assigns a value to the corresponding attribute.
Note the following two details:
First, real-time preview only responds to changes in size and component parameters, and all other attributes (Position, rotation, style...) are invalid for real-time preview.
Second, real-time preview directly assigns values to component parameters, rather than calling related methods.

3. Make a simple real-time Preview
Creating a simple SWF file is simple: Create a New FLA file and set the file class to FL. livepreview. livepreviewparent, drag the component to the scene, make sure that all the settings of the component are the default value, and finally release the component -- done!

4. Make a more advanced real-time Preview
In components, there are always some things that should not appear in real-time preview, such as the sub-item loaded by the accordion component. accurately speaking, all components, including icons and loaded files, should not appear in real-time preview. Otherwise, unknown problems may occur.
Therefore, you should use the checklivepreview (): Boolean method (inherited from uicomponent) in the component to check whether the component is in the real-time preview state.
For external components loaded, you can choose not to load them in real-time preview, or load a built-in component to replace them.
For example
If (checklivepreview ()){
// Insert the code for real-time preview here
}

5. Simplified Real-Time Preview
If you think real-time preview is too large, you can link the Real-Time preview to another class, which is a lite version that only implements the methods and attributes required for real-time preview. in this way, the component is separated from the real-time preview, which is easy to modify.
Real-time preview can streamline all attributes and Methods unrelated to component parameters, remove all listeners (events are not required in real-time Preview), and change styles to unchangeable, this simplifies the code.
For a Simplified Real-Time preview, see COM. cyjb. livepreview. livepreview_accordion.as in the attachment.

So far, the creation of Flash CS3 component series has come to an end, for the component of what problems, you can leave a message to me, or mail: f8cyjb@126.com

Final components and source files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.