Any AS3 geeks on here?

Started by Slide Panda, June 12, 2008, 11:52:18 AM

Previous topic - Next topic

Slide Panda

Nerds of a feather...

Actually I'm a little stumped at how to do something in AS3 using LocalConnection to get a few SWFs behave like I want.  So if you know your ActionScipt, feeling helpful and want more details please lend a hand
-Throttle's on the right, so are the brakes.  Good luck.
- '00 M900S with all the farkles
- '08 KTM 690 StupidMoto
- '07 Triumph 675 Track bike.

darylbowden

#1
Quote from: yuu on June 12, 2008, 11:52:18 AM
Nerds of a feather...

Actually I'm a little stumped at how to do something in AS3 using LocalConnection to get a few SWFs behave like I want.  So if you know your ActionScipt, feeling helpful and want more details please lend a hand

What do you want to do?  LC is a real PITA and make the beast with two backss other stuff.  I prefer to use ExternalInterface (and then JS obviously) to get SWFs to talk to each other.  If you can tell me exactly what you're trying to do (and maybe post relevant snippets), I can help you fix it.

Until recently I did nothing BUT AS3 for about a year and a half and I still have contacts with some of the best in the industry so don't fret.

Slide Panda

Basically I've got a parent SWF and 4 children.  Users swap out those 4 swfs via a menu contained in the parent... but then someone got the bright idea that one can click something in child2, then child3 will load with the relevant section of it's content fired up.  Goodie gum drops.

I've been able to get child2 to pass the necessary info to the parent, and then back down to child3 once child 3 is loaded.  Thought it's a bit of a bodge 1st draft code right now.  But all this only works the 1st time child3 is loaded.  If you leave child3s section (and as a result unload the swf) and come back (reloading child3) the localConnection is still open and we can't very well have two instances.

I've tried _connectionName.close(); - but the stupid thing comes back and tells me that the connection I KNOW is open.. isn't

Make sense?
-Throttle's on the right, so are the brakes.  Good luck.
- '00 M900S with all the farkles
- '08 KTM 690 StupidMoto
- '07 Triumph 675 Track bike.

darylbowden

Quote from: yuu on June 12, 2008, 05:09:32 PM
Basically I've got a parent SWF and 4 children.  Users swap out those 4 swfs via a menu contained in the parent... but then someone got the bright idea that one can click something in child2, then child3 will load with the relevant section of it's content fired up.  Goodie gum drops.

I've been able to get child2 to pass the necessary info to the parent, and then back down to child3 once child 3 is loaded.  Thought it's a bit of a bodge 1st draft code right now.  But all this only works the 1st time child3 is loaded.  If you leave child3s section (and as a result unload the swf) and come back (reloading child3) the localConnection is still open and we can't very well have two instances.

I've tried _connectionName.close(); - but the stupid thing comes back and tells me that the connection I KNOW is open.. isn't

Make sense?

Yep. 

Use ExternalInterface.  I'd have to actually look at your code to debug it, but there's a couple issues.  For instance, try opening another instance of your site in another tab or window while using LC and see what happens.  LC has always been (IMO and many others) a kinda hacked POS.  You can use ExternalInterface to pass everything back/forth between them without having to worry about conflicts, connections not closing, etc.  Also, LC is a big memory hog and slows down your app.  If you want to email me the classes you're working with (with comments detailing where I should look), I can take a look and see if I see something inherently wrong with your code, but i STRONGLY recommend ditching LC and using ExternalInterface. 

Slide Panda

Hmm yeah - didn't even think of running duplicate instances of the site.  I don't even need to do that test to know it'll be fubar.

I'm going to clean up my code, zip it up so you can have a look.  Since its a work in progress it's a bit messy, so I'll organize and comment it.  I'll shoot you a PM for your email info.

Know of any issues using ExternalInterface with SWFObject?

Got any coded examples of ExternalInterface in action?  I usually learn best by concrete examples.
-Throttle's on the right, so are the brakes.  Good luck.
- '00 M900S with all the farkles
- '08 KTM 690 StupidMoto
- '07 Triumph 675 Track bike.

darylbowden

Quote from: yuu on June 13, 2008, 06:51:16 AM
Hmm yeah - didn't even think of running duplicate instances of the site.  I don't even need to do that test to know it'll be fubar.

I'm going to clean up my code, zip it up so you can have a look.  Since its a work in progress it's a bit messy, so I'll organize and comment it.  I'll shoot you a PM for your email info.

Know of any issues using ExternalInterface with SWFObject?

Got any coded examples of ExternalInterface in action?  I usually learn best by concrete examples.

No issues with SWFObject.  I always use SWFObject to embed my flash/flex.  When you send it to me, I'll send you back some basic examples.  It's really easy - easier to deal with than LC - promise.