FORUMS: list search recent posts

Action script conversion issue

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jag Jagsson
Action script conversion issue
on Nov 28, 2008 at 12:04:40 pm

Hi everyone,
Are working on a flash presentation with mixed media files. Although I suck at action script I manage to (with support) make a working flash-film in action script 2.0. Now I want it to work with AS 3.0 so that I will be able to use quicktime movies. I built the presentation from different scenes which has different contents. I navigates by pressing arrow keys or space.. But..

My "navigation code" (from the first frame of the AS 2.0 presentation) seems not to be compatible at all. Is there a simple way to re-write it to AS 3.0 or what should I do? It is probably extremely simple for anyone but me;P

The code looks like this:

fscommand( "fullscreen", true );
fscommand( "allowscale", false );
var oKeyListener:Object = new Object();
oKeyListener.onKeyDown = function():Void {
if(Key.getCode() == 39){

nextFrame();

}
if(Key.getCode() == Key.LEFT){

prevFrame();


}
if(Key.getCode() == Key.SPACE){

nextFrame();


}
};
Key.addListener(oKeyListener);

//mousehide
this.attachMovie("pointer_id", "pointer_mc", this.getNextHighestDepth());
Mouse.hide();
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
pointer_mc._x = _xmouse;
pointer_mc._y = _ymouse;
updateAfterEvent();
};
Mouse.addListener(mouseListener);

stop();


Return to posts index

Pieter Helsen
Re: Action script conversion issue
on Nov 29, 2008 at 12:08:28 pm


fscommand( "fullscreen", "true" );
fscommand( "allowscale", "false" );

// In your library, right click on your custom cursor and select
// Properties or Linkage. Then, tick the box Export for Actionscript and give
// it the class name CustomCursor. It should extend flash.display.MovieClip.
// You'll get a warning that the definition does not exist and will be created for you.
// That's what we want. So just go ahead and ignore that.

// Using the new CustomCursor basically is the AS3 equivalent of attachMovie.
var customCursor:CustomCursor = new CustomCursor();
addChild(customCursor);
Mouse.hide();

addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

function keyDownHandler(evt:KeyboardEvent):void {
if(evt.keyCode == Keyboard.RIGHT){
nextFrame();
}

if(evt.keyCode == Keyboard.LEFT){
prevFrame();
}

if(evt.keyCode == Keyboard.SPACE){
nextFrame();
}
}

function mouseMoveHandler(evt:MouseEvent):void {
customCursor.x = mouseX;
customCursor.y = mouseY;
}


stop();


Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index

Jag Jagsson
Re: Action script conversion issue
on Dec 1, 2008 at 12:40:53 pm

You are my hero Pieter! Really.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]