FORUMS: list search recent posts

migration to as3

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Solange Gomes
migration to as3
on Mar 23, 2011 at 10:11:43 pm

Hi, i need some help.
I'm trying to migrate a entire code AS2 to AS3, so some troubles are appearing, like this one: in AS2 the code i will past next do a slide gallery with buttons to see more pictures, but in AS3 the gallery won't move and the buttons won't work.
Can anyone see what is the problem in code?

AS2:

function SlideMenu()
{
this._x = this._x + (newX - this._x) / 5;
this._y = this._y + (newY - this._y) / 5;
} // End of the function
WindowIN.Contents.onEnterFrame = SlideMenu;
newX = 0;
newY = 0;
PageTotal = 23;
CounterDisplay = 1;
Forward.Forward.onPress = function ()
{
++CounterNumber;
++XNumber;
if (CounterNumber > PageTotal - 1)
{
CounterNumber = 0;
XNumber = 0;
YNumber = 0;
} // end if
CounterDisplay = CounterNumber + 1;
if (XNumber > 50)
{
XNumber = 0;
++YNumber;
} // end if
newX = -XNumber * 60;
newY = -YNumber * 50;
if (CounterDisplay == 51)
{
trace ("no foward");
} // end if
trace ("a página " + CounterDisplay + " tem a posição x=" + WindowIN.Contents._x + " e a posição Y=" + WindowIN.Contents._y);
};
Back.Back.onPress = function ()
{
if (CounterDisplay == 1)
{
}
else
{
--CounterNumber;
--XNumber;
if (CounterNumber < 0)
{
CounterNumber = PageTotal - 1;
XNumber = 9;
YNumber = 9;
} // end if
CounterDisplay = CounterNumber + 1;
if (XNumber < 0)
{
XNumber = 9;
--YNumber;
} // end if
newX = -XNumber * 60;
newY = -YNumber * 50;
} // end else if
trace ("a página " + CounterDisplay + " tem a posição x=" + WindowIN.Contents._x + " e a posição Y=" + WindowIN.Contents._y);
};


AS3:
import fl.controls.Button;
//SlideMenu

WindowIN.Contents.addEventListener(Event.ENTER_FRAME, enterFrame);//=Slide Menu
function enterFrame(event:Event):void
{
this.x = this.x + (newX - this.x) / 5;
this.y = this.y + (newY - this.y) / 5;
} // End of the function

newX = 0;
newY = 0;
PageTotal = 23;
CounterDisplay = 1;
(Forward.Forward).addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
function mouseDown( evt:MouseEvent):void
{
++CounterNumber;
++XNumber;
if (CounterNumber > PageTotal - 1)
{
CounterNumber = 0;
XNumber = 0;
YNumber = 0;
} // end if
CounterDisplay = CounterNumber + 1;
if (XNumber > 50)
{
XNumber = 0;
++YNumber;
} // end if
newX = -XNumber * 60;
newY = -YNumber * 50;
if (CounterDisplay == 51)
{
trace ("no foward");
} // end if
trace ("a página " + CounterDisplay + " tem a posição x=" + WindowIN.Contents.x + " e a posição Y=" + WindowIN.Contents.y);
};
(Back.Back).addEventListener(MouseEvent.MOUSE_DOWN, mouseDown2);
function mouseDown2( evt:MouseEvent):void
{
if (CounterDisplay == 1)
{
}
else
{
--CounterNumber;
--XNumber;
if (CounterNumber < 0)
{
CounterNumber = PageTotal - 1;
XNumber = 9;
YNumber = 9;
} // end if
CounterDisplay = CounterNumber + 1;
if (XNumber < 0)
{
XNumber = 9;
--YNumber;
} // end if
newX = -XNumber * 60;
newY = -YNumber * 50;
} // end else if
trace ("a página " + CounterDisplay + " tem a posição x=" + WindowIN.Contents.x + " e a posição Y=" + WindowIN.Contents.y);
};

Thanks *


Return to posts index

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