PDA

View Full Version : AS2 -> AS3 Issues...



GGMcGee
September 10th, 2009, 12:25 AM
I know barely anything about Actionscript. I can work with it when certain variables are staring me in the face, but that's about it.

I need to insert have a video on a webpage. I have some AS2 that detects a cuepoint at the end of the flv and sends the .swf back to frame 1. I have some AS3 that makes the video full screen when a button is clicked.

They don't like eachother.

Can someone please 'convert' my cuepoint AS2 code to AS3 code? I need it to work with my fullscreen AS3 code...

Also, this seems so simple and silly, but I no longer know how to create a button that'll advance to a frame when clicked. I knew how to do it in AS2, but AS3 is weird and scary to me. Can someone tell me how to do it?

Cuepoint AS2 code...:


stop();

var listenerObject:Object = new Object();

listenerObject.cuePoint = function(eventObject:Object):Void {

if(eventObject.info.name=="cue1"){
gotoAndStop(1);
}
}
vid.addEventListener("cuePoint", listenerObject);
Thanks in advance for your help.

GGMcGee
September 10th, 2009, 07:01 PM
...anyone?:ninja:

Scythe
September 10th, 2009, 11:32 PM
Try this.


import fl.video.MetadataEvent;

stop();

function eventHandler(event:MetadataEvent):Void {
if(event.info.name == "cue1") {
gotoAndStop(1);
}
}
vid.addEventListener(MetadataEvent.CUE_POINT, eventHandler);

GGMcGee
September 14th, 2009, 07:04 PM
Thanks heaps! It worked. One thing though: had to change Void to void. The capitalisation broke it XD.

Also found an answer to how to make a button advance to a frame in AS3:



yourButton.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
gotoAndStop(whateverFrame);
}


:D

Scythe
September 14th, 2009, 08:07 PM
Yes, of course void can't be capitalized. Can't believe I overlooked that.