View Single Post
  #1 (permalink)  
Old 05-12-2008, 10:42 AM
sammy545
 
Posts: n/a
Diggs:
Default Trying to get an Action Script 3.0 class to work

I have been trying to get this example that comes with the flash CS3
documentation to work. In step 1, when it says to add the List and Button
components to the library, does that mean to open 'components' and drop a List
control and a Button control to the library. If so, do I need to do anything
with these controls after I do this? Also, when it says to create an Icon
symbol and name it 'myIcon'. Does this mean that I drop a square onto the
canvas in the .fla file and then convert it to a symbol. Do I name the new
symbol 'myIcon' or do I name the instance, which is in the property inspector
to 'myIcon'. Sammy


To run the example, follow these steps:

Add the List and Button components to the library.
Create an icon symbol and name it MyIcon.
In the symbol properties for MyIcon, toggle the option "Export for
ActionScript".
Save this code as LabelButtonExample.as in the same directory as your FLA
file.
Set the Document class in the FLA file to LabelButtonExample.


package
{
import flash.display.Sprite;
import flash.events.Event;
import fl.data.DataProvider;
import fl.controls.List;
import fl.controls.ComboBox;
import fl.core.UIComponent;
import fl.events.ListEvent;

public class LabelButtonExample extends Sprite
{
public function LabelButtonExample() {
var myIcon:IconWithToolTip = new IconWithToolTip();
myIcon.setStyle("icon", MyIcon);
myIcon.iconDescription = "Icon Description";
myIcon.move(50,50);
addChild(myIcon);
}
}
}

Reply With Quote
Sponsored Links