Log in

View Full Version : newby simple actionscript needed, help!



moscarda
02-17-2009, 07:44 AM
hey, i'm just learning my way around flash, for the most part i've been using it encode movies for my websites, as i'm still a css/dhtml webdesigner.

i've built a site with multiple dhtml pop-up windows, each with a swf movie embedded in the div. what i'd like to do is, once the dhtml window is open, have the swf start playing, and then once it is finished, use actionscript to close the dhtml window. that is possible right? i just have never touched actionscript so i don't know where to start. could somebody help me out?

on my other dhtml pop-ups this code is what i'm currently using to close/hide the div:


onclick="document.getElementById('popup').style.display = 'none';"

i dunno if there is a way to call this kind of script when used with actionscript inside the swf. forgive my vocabulary, in case i'm not using the right words to describe this, like i said, i'm very new to this. hopefully you still understand what i'm asking....

moscarda
02-17-2009, 06:51 PM
your post is neither helpful nor relevant to the thread. go away.

Medyman
02-17-2009, 06:56 PM
@moscarda

Yes, it's possible though complicated. You've picked one heck of a starting point to get into ActionScript. Your basic idea is correct. You would have to call the JavaScript from within the SWF.

You do this using the ExternalInterface Class (a.ka. External API). This offers a way to link between JS and AS.

Now that you know the vocabulary, I'll let you Google around for some guides. I've also touched on the External API in this forum a lot, so you might want to search for that term here.

If you need more guidance, post what version of AS you're using and I'll see if I can be of more assistance.

@Arpita
I've asked the mods to split your post off into a new thread because it has nothing to do with moscarda's origial question. Once they do, I'll have a look at your post there. In the future, please create a new topic for unrelated questions.

moscarda
02-17-2009, 06:59 PM
Hey thanks, i'll do my best to figure out the ExternaInterface() solution. I have adobe flash cs 4, which lets you choose which version of actionscript. Which do you recommend for this project? Thanks again,

moscarda

Medyman
02-17-2009, 07:06 PM
Which do you recommend for this project?

It doesn't really matter, but I find the AS3 implementation (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html)slightly easier to work with.

moscarda
02-17-2009, 07:25 PM
you are right, bad place to start...this is all way over my head. is there an ExternalInterface() tutorial for dummies out there? my brain hurts.

Medyman
02-17-2009, 07:28 PM
Lol. This (http://www.adobe.com/devnet/flash/articles/external_interface_05.html) is the only tutorial of the External API that is worth mentioning. It's not a topic that many have covered. I think that the assumption is that when you get to a point where the External API is necessitated, you're advanced enough to not really need a step-by-step tutorial