variables in a Loader

9 posts (showing 1-9)
Lord_Garland

Market Level 4Community Level 9
1873 posts

Is there anyway  to access a variable from a Loader.

I download a swf and I want to access variables inside it.

If I turn it into a movieclip I get all kinds of sand box errors. I can't seem to find away around them either.

So anyone have any ideas?

posted 2015-04-24T09:10:48-07:00
bluebox

Market Level 6Community Level 3
334 posts

if, by Loader you mean swf file that is loading other swf, you have access to public vars defined in second swf as well as public functions

posted 2015-04-24T14:41:47-07:00 | edited 2015-04-24T14:42:02-07:00
FoumartGames

Market Level 3Community Level 4
209 posts

Are you sure the loaded SWF is the same AS version ? Because loading AS2 through AS3 and communicating between is almost impossible, involving wrappers, LocalConnections and a lot of headache :D

posted 2015-04-24T18:27:33-07:00 | edited 2015-04-24T18:27:55-07:00
Lord_Garland

Market Level 4Community Level 9
1873 posts

It should be the same AS version.

I can't seem to get it to work.

If anyone has sample code that would be great.

posted 2015-04-24T21:58:48-07:00
Lord_Garland

Market Level 4Community Level 9
1873 posts

Any know how to do this?

It should be the same AS version.

posted 2015-04-25T21:23:05-07:00
FoumartGames

Market Level 3Community Level 4
209 posts

Try to encapsulate the variable name as string like this:

(loader as MovieClip)["varName"];

but after the event complete. it will most likely not work, but it's first thing that I'd try..

posted 2015-04-25T22:37:57-07:00 | edited 2015-04-25T22:40:34-07:00
Lord_Garland

Market Level 4Community Level 9
1873 posts

I found a work around.

posted 2015-04-26T00:21:22-07:00
Rainmaker11

Market Level 0Community Level 0
2 posts

Take a look at the Greensock site:

Their version of a loader will allow variables.

https://greensock.com/LoaderMax-AS3

posted 2015-05-19T00:32:24-07:00
Lord_Garland

Market Level 4Community Level 9
1873 posts

Found a work around long time ago now.

Thanks for the help anyway.

posted 2015-05-19T00:57:18-07:00