PDA

View Full Version : Flex 3 and embeding


markblue777
10-01-2008, 04:08 PM
Hi all,
I have a problem. My problem is in flex 3 and with embeding a swf.
In my swf i have just a simple little pop up window with 5 text fields in it (dynamic and named)

what i want to do is embed it into my application then get access to it so i can get access to the text fields within it so i can change them.

now i can get the movie clip fine (i can add it to the scene and remove it)
however if i try to access a textfield on it i get the error of.

"ReferenceError: Error #1069: Property popUp not found on Main_popUpMenu and there is no default value."

in my swf i have the movie clip named pop.

so in thoery

m_mc.pop.heading.text = "test";

should change the text for the heading text field. However it does not and it just shows the error above. I have spent a couple of hours on this now and still no luck. Does anyone have any thoughts.
Regards
Mark

arkum
10-01-2008, 06:46 PM
Maybe...

In your (Flash)PublishSettings/settings untick 'automatically Declare Stage Instances', then in your Document class, create public vars for your Textfields.

Then when you try to access properties of the swf, cast it to your Document class -

if your doc class is called MyLovelyDocClass, you would then access the textfields like so...

MyLovelyDocClass(myEmbededSWF).myTextField1.text = "Whatever"

hth

markblue777
10-03-2008, 08:14 AM
Hi arkum,
Thanks for the reply. i got around it by loading it in instead of embedding it i dont no why it never embeded but it is working now :).

on another side note when i embed i do [Embed(source = "/../img/Havana.swf")]

So i am therefore goin back a directory and looking in an img folder. obviously i dont want this to happen as i want it to be [Embed(source = "img/Havana.swf")] so it looks in the current directory it is is. But when i do this it just does not find the files to embed (even though the files and folder is there. Any thoughts?
Regards
Mark

arkum
10-03-2008, 09:21 AM
What does your folder structure look like - where is your mxml file in relation to the swf you want to embed?

markblue777
10-03-2008, 09:32 AM
Hey arkum,
I did not no it was relative to the mxml. i thought it was relative to the where the swf was. i moved it to the location of my mxml and it worked fine.
Cheers
Mark

arkum
10-03-2008, 09:50 AM
Nice.