I’m creating animations in Flash and using Google Swiffy to convert them to HTML5 animations. I controlled them with Actionsript 2 method below but now they need it as AS3 and I just can’t get it to work.
I don’t know if I need to simply change the AS2 to AS3 or if I should look into new methods, but I’m literally about to cry.
Javascript placed within HTML5 animation:
<script>
function playMovie(){
stage.setFlashVars('myresponse=play');
return false;
}
function stopMovie(){
stage.setFlashVars('myresponse=pause');
return false;
}
</script>
Actionscript:
_root.onEnterFrame = function(){
switch(_level0.myresponse){
case 'play':
_root.play();
break;
case 'pause':
_root.stop();
break;
default :
break;
}
_level0.myresponse = undefined;
}
Any help is appreciated or even a push in the right direction, and I’m definitely serious about paying or donating.
Yeah I tried translating it as follows with the three things I found being the removal of “_” naming, “_root” being either “root” or “stage”, event for enter frame, root.parameters.variable sent in with JavaScript
addEventListener(Event.ENTER_FRAME,myEnterFrame);
function myEnterFrame(event:Event) {
switch(root.loaderInfo.parameters.myresponse){
case 'play':
root.play();
break;
case 'pause':
root.stop();
break;
default :
break;
}
root.loaderInfo.parameters.myresponse = undefined;
}
Tried the above with stage.play() and stage.stop() as well, and a few other tweaks hours before even asking.
So it’s MovieClip(root).play & MovieClip(root).stop, correct? I’m definitely up to donate as stated if this leads to a solution.
Two biggest problems are
I don’t understand the switch operation - can that be put in another way?
I can’t really use trace to see how far I’m getting: if the variable I pass in is getting passed, etc.
Is there a way to see more what’s going on? with Javascript maybe?
Hmm yeah, there used to be an AS1/2 to AS3 syntax migration guide in one of the AS3LR appendixes… but I can’t find it in the current version online. Weird.
Creating engaging and entertaining content for designers and developers since 1998.