Marius van Witzenburg "Learned my lesson in life, now setting my action to stay in life."

24Jun/100

Control a flash movie from javascript and javascript from flash movies

Personally I dislike the usage of Flash in my websites but our clients request a lot that they want animations. Now it happens that they want the animation to act upon an action to a non-flash object. This can be difficult if you have no idea how to do that. If you read below, you should have no problem with getting this job done :-)

Control your Flash Movie from Javascript:

// Play movie
document.getElementById('myFlashMovie').Play();
// Stop movie
document.getElementById('myFlashMovie').StopPlay();
// Rewind movie to beginning
document.getElementById('myFlashMovie').Rewind();
// Goto next frame of MovieClip
document.getElementById('myFlashMovie').TGetProperty(nameOfTargetMovieClip, propertyIndex);
// Goto next frame of TimeLine
document.getElementById('myFlashMovie').GotoFrame(frameNum);
// Zoom in or out the flash movie
document.getElementById('myFlashMovie').Zoom(relative percentage);
// Set variable and make it available via ActionScript
document.getElementById('myFlashMovie').SetVariable(variableName, variableValue);
// Get variable for usage in JavaScript
var myVariable = document.getElementById('myFlashMovie').GetVariable(variableName);

To control Javascript functions you can call it like this:

getURL("javascript:naam_van_functie();");

For some more information about these methods, please check out the Adobe website.

I hope this helps you out with getting that Flash Movie behave like you want it to ;-)

24Mar/100

Make a Flash movie redirect with ActionScript3 from your timeline

You can use the following code to simply redirect from a key in your timeline.

I used this to redirect after my preloader finished.

1
2
3
4
5
6
7
var url:String = "home.html";
var request:URLRequest = new URLRequest(url);
try {
    navigateToURL(request, "_self");
} catch (e:Error) {
    trace("Error occurred!");
}
10Aug/090

My addiction, Raiden X. Great game!

This is a small game that is quite nice to play and quite addicting too :)

Have fun while playing!