Hi guys,

I've hit a huge hurdle when trying to communicate between AVM1 and AVM2.

I've been trying to create a component - call it AVM1Loader - which
will allow simple communication between an AVM2 flex app and a
contained AVM1 file.

In theory, it's pretty simple:

- Use Loader to load the file.
- Create a LocalConnection for AVM2 to talk to AVM1
- Create a LocalConnection for AVM1 to talk to AVM2

This all works fine, and communications all work.

However, the problem comes with the naming of the LocalConnections.
Clearly each AVM1Loader instance wants to have a differently named
pair of LocalConnections; otherwise you'll get into trouble if you're
trying to have two AVM1Loaders running together at the same time - or
even two instances of the same Flex app running together at the same
time.

Generating a unique ID is easy, but I can't for the life of me work
out how to communicate it to the contained AVM1 file.

The obvious way would be to pass it as a parameter: e.g.
_loader.load(new URLRequest("AVM1File.swf?key="+someUniqueKey));

That works, but only (apparently) once. The next time you try to load
AVM1File.swf with a _different_ key (under a whole new instance of
AVM1Loader) something very odd happens. The key value does get
transmitted correctly on the second run, but the _root of the
contained movie gets screwed up.

These simple trace statements are on the root of AVM1File.swf:

trace(_root);
trace(_root.clip); // (Clip is an instance defined on the stage of AVM1File)
trace(_parent);

On the first (successful) load (i.e. loading
"AVM1File.swf?key=someUniqueKey"), I get:
"_root"
"_root.clip"
"undefined"

Which is as expected. On the second run through (i.e. loading
"AVM1File.swf?key=someOtherKey"), I get:

"_root"
"_level0.App0.Panel4.contentPane.AVM1Loader40.instance55.instance56.clip"
"_level0.App0.Panel4.contentPane.AVM1Loader40.instance55"

Which is very strange - suddenly my AVM1 code is seeing its AVM2
instance name. And from that point on, the AVM1 code stops working
correctly - loading clips etc. fails.

If I change the URL to just "AVM1File.swf" it all works fine, but
obviously my unique key doesn't get transmitted. Similarly, fixing the
URL - sending "AVM1File.swf?key=dummy" each time - works fine.
Somethings up when you alter the parameter.

It's a new instance of Loader() - I'm not reusing anything.

So - that's clearly some sort of bug, and I seem to have hit a blank
wall there. If anyone's got any ideas on that peculiarity then great.

But that aside, if anyone's got any brainwaves on how to simply
communicate a unique ID to an AVM1 file I'm loading, that'd be great.
:-)

Yours in frustration,
  Ian


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to