Re: [flexcoders] Loading AVM1 content into AVM2

2006-09-17 Thread Ian Thomas
On 9/17/06, Daniel Wabyick [EMAIL PROTECTED] wrote:

 Yeah, I just reproduced your bug ... Seems like the reference to _root
 gets screwed up on subsequent calls. What's *really* interesting ... If
 I comment out the cleanup in your AVMLoader class, I can *crash* Eclipse ...

 if (_loader!=null)
 {
 //_loader.unload();
 //removeChild(_loader);
 //_loader=null;
}

Wow - yes. Certainly Firefox crashes if I comment it out; I don't know
if that's the same issue you were having. I'll make sure that gets
filed, too. Thanks.

 Note that your publish path for your FLA is
 incorrect. It should be bin/AVMTestMovie.swf but its bin/AVMMovie.swf.

Whoops - thanks; I renamed it to make things a bit clearer just before
I made the archive (of course!)

Cheers,
  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/
 




[flexcoders] Loading AVM1 content into AVM2

2006-09-16 Thread Ian Thomas
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/
 





Re: [flexcoders] Loading AVM1 content into AVM2

2006-09-16 Thread Daniel Wabyick

That most definitely sounds like a bug ...  I think the following would 
work:

- Create a class LocalConnectionDaemon in AVM2 that is connected under a 
hardcoded LC name. ( e.g. LC_DAEMON );

-  Create a class LocalConnectionDaemon in AVM1 that does the following:
- Generates a unique LocalConnection URL based on the 
current-time-millis ( e.g. var clientId:String = LC_CLIENT_1324343243243 )
- Send a command to LocalConnectionDaemon via - LC_SERVER  .. 
createClient( clientId )
- Listen for a command (on that same LocalConnection, or one the 
server can figure out) called   onClientCreated( otherClientId:String )

- LocalConnectionDaemon should have a method  createClient( 
clientId:String ) that takes the ID, and transforms it to a guaranteed 
unique name
(e.g.  var newClientId:String = clientId + _AVM2) and sends  
onClientCreated( newClientId );
 
Definitely more painful, but doable.  I should point out that one big 
issue with LocalConnection is that messages are limited to 40kb. You may 
need to chunk your requests over if they are large.


Also, just thought this would be a good time  to point out Adobe's  
bug-report / wishlist page. If you send them a *reproducable*  bug 
report, they will get back to you very quickly:

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Regards,
-D




Ian Thomas wrote:

 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/
 





Re: [flexcoders] Loading AVM1 content into AVM2

2006-09-16 Thread Daniel Wabyick

That most definitely sounds like a bug ...  I think the following would 
work:

- Create a class LocalConnectionDaemon in AVM2 that is connected under a 
hardcoded LC name. ( e.g. LC_DAEMON );

-  Create a class LocalConnectionDaemon in AVM1 that does the following:
- Generates a unique LocalConnection URL based on the 
current-time-millis ( e.g. var clientId:String = LC_CLIENT_1324343243243 )
- Send a command to LocalConnectionDaemon via - LC_SERVER  .. 
createClient( clientId )
- Listen for a command (on that same LocalConnection, or one the 
server can figure out) called   onClientCreated( otherClientId:String )

- LocalConnectionDaemon should have a method  createClient( 
clientId:String ) that takes the ID, and transforms it to a guaranteed 
unique name
(e.g.  var newClientId:String = clientId + _AVM2) and sends  
onClientCreated( newClientId );
 
Definitely more painful, but doable.  I should point out that one big 
issue with LocalConnection is that messages are limited to 40kb. You may 
need to chunk your requests over if they are large.


Also, just thought this would be a good time  to point out Adobe's  
bug-report / wishlist page. If you send them a *reproducable*
bug report, they will get back to you very quickly:

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Regards,
-D




Ian Thomas wrote:

 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/
 




Re: [flexcoders] Loading AVM1 content into AVM2

2006-09-16 Thread Ian Thomas



Hi Daniel, Thanks for that. If I understand you correctly, you're suggesting creating a known LocalConnection which acts as an 'ID server' in AVM2. I had thought about something similar. The issue is that I can't see how the pairing up works between an AVM1Loader (the AS3 component) and it's contained AVM1 movie. I can understand using a known point for the AVM1 movie to talk to, but can't see how you can guarantee that the right IDs can be guaranteed to be known by both parent and child if, for example, two such pairs are being created at the same time. You can't queue it - 
e.g. FIFO - because you can't guarantee that the first AVM1 movie loads faster than the second. And you can't even do it by URL mangling or somesuch, because we might be dealing with loading the same movie into two different components (which is the case in my setup).
 Additionally, I think the known server fails if (for example) two copies of the same Flex app were running at the same time - although I guess you could get around that by querying LC_DAEMON to see if it already exists before creating it.
 I'll play around with the idea and see if I can make sense of it; unless you've any other light to shed. :-) Thanks for the Adobe info - I'll create a simple test case and drop a note to them.Cheers,
 IanOn 9/16/06, Daniel Wabyick [EMAIL PROTECTED] wrote:













  




That most definitely sounds like a bug ...  I think the following would 
work:

- Create a class LocalConnectionDaemon in AVM2 that is connected under a 
hardcoded LC name. ( e.g. LC_DAEMON );

-  Create a class LocalConnectionDaemon in AVM1 that does the following:
- Generates a unique LocalConnection URL based on the 
current-time-millis ( e.g. var clientId:String = LC_CLIENT_1324343243243 )
- Send a command to LocalConnectionDaemon via - LC_SERVER  .. 
createClient( clientId )
- Listen for a command (on that same LocalConnection, or one the 
server can figure out) called   onClientCreated( otherClientId:String )

- LocalConnectionDaemon should have a method  createClient( 
clientId:String ) that takes the ID, and transforms it to a guaranteed 
unique name
(e.g.  var newClientId:String = clientId + _AVM2) and sends  
onClientCreated( newClientId );
 
Definitely more painful, but doable.  I should point out that one big 
issue with LocalConnection is that messages are limited to 40kb. You may 
need to chunk your requests over if they are large.

Also, just thought this would be a good time  to point out Adobe's  
bug-report / wishlist page. If you send them a *reproducable*  bug 
report, they will get back to you very quickly:

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Regards,
-D

Ian Thomas wrote:

 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