Copy link to clipboard
Copied
I've been searching all day trying to figure out how I can go about accessing properties decalared with in a flash component or containers base actionscript class.
I need to create a fairly complex interface within a part of a flex web app and I think it would be better to create it in flash profressional. I just cannot find any good information on how to get xmxl/flex to play nicely with swf/swc. Maybe it's justs not possible.
Any help or even a point in the right direction would be greatly appreciated.
Copy link to clipboard
Copied
So I ended up answering my own question, but thought I would share how I did it since I can't seem to find any instructions or examples anywhere.
So what I wanted in the end was a swc file running within my flex app but I need to be able to pull data out of my swc for use with in flex. These are the steps I took to get there. If you read through this and feel there is a better way of achieving the end result please share.
Start out by adding a Flash Professional Container to your FLEX project (I dont know the difference between Component and Container, all I figured out is Component would blow up when I started adding classes with the Flash Professional project)
Give the Container and ID. mine is myTest
Double click and open the Container with in Flash Professional
Once in Flash Professional go to the Library tab and right click to add a new Symbol.Make it a MovieClip and name it what ever you would like and export it for Actionscript. **I have yet to add more to this but I plan on treating this as my "Stage" or base view.
Once created drag a new instance into the view. Make sure it is at 0,0 and give it a instance name. You will use this name as your accessor in FLEX
Right click on your new movie clip in the Library tab and selecet edit class. since all I wanted was a string I created a private string and its public getter method
private var _dataString:string = "Some string of data";
public function get dataString():String {
return _dataString;
}
Save your class and close it
Click the Done button in the .fla window to save your Flash project and return to Flash Builder.
Now with in the actionscript section of my MXML I can access the string above by myTest.appMain.dataString; appMain is the instance name of the movieclip I created in Flash Professional.
Now that I figured this out it seems so trival and shouldnt have taken me so long to figure out. I'm just surprised I couldn't find more info on the web about getting Flash components/containers to work well with in Flex/Flash Builder.
I hope this helps someone out.