how to make this a class!?

By archloxx | Jul 4, 2009

hey all, i have a code that i took from a tutorial, i made few adjustments to it,

then i realized it will be cool if i make it a class, so i can assign it to any item in the stage, the thing is, am not exposed to classes, and this code actually triggers a movie clip on the stage,

what i need to do, is to make like a general class, and all i need to do is to assign any item on the stage from the main fla file to that class, so it implements the effect,

in the code, thumb is the item on the stage, the tough part for me is that, how can i make the class read thumb as anything i tell it to be? since am not going to put all my movieclips as thumb

here is the code:

ActionScript Code:
var bounds:Object={left:0,right:stage.stageWidth}; var boundsY:Object={top:0,bottom:stage.stageHeight}; var currentX:Number=thumb.x; var currentY:Number=thumb.y; var lastX:Number=thumb.x; var lastY:Number=thumb.y; var vx:Number=0; var vy:Number=0; var isDragging:Boolean=false; var offset:Number; var offsetY:Number; thumb.buttonMode=true; addEventListener(Event.ENTER_FRAME, loop); thumb.addEventListener(MouseEvent.MOUSE_DOWN, onDown); addEventListener(MouseEvent.MOUSE_UP, onUp); function onDown(e:MouseEvent):void {     isDragging=true;     offset=thumb.mouseX;     offsetY=thumb.mouseY;     addEventListener(MouseEvent.MOUSE_MOVE, onMove); } function onUp(e:MouseEvent):void {     isDragging=false;     removeEventListener(MouseEvent.MOUSE_MOVE, onMove); } function onMove(e:MouseEvent):void {     thumb.x=mouseX-offset;     thumb.y=mouseY-offsetY;     if (thumb.x<=bounds.left) {         thumb.x=bounds.left;     } else if (thumb.x >= bounds.right) {         thumb.x=bounds.right;     } else if (thumb.y<=boundsY.top) {         thumb.y=boundsY.top;     } else if (thumb.y >= boundsY.bottom) {         thumb.y=boundsY.bottom;     }     e.updateAfterEvent(); } function loop(e:Event):void {     if (isDragging) {         lastX=currentX;         lastY=currentY;         currentX=mouseX;         currentY=mouseY;         vx=currentX-lastX;         vy=currentY-lastY;     } else {         thumb.x+=vx;         thumb.y+=vy;     }     if (thumb.x<=bounds.left) {         thumb.x=bounds.left;         vx*=-1;     } else if (thumb.x >= bounds.right) {         thumb.x=bounds.right;         vx*=-1;     } else if (thumb.y<=boundsY.top) {         thumb.y=boundsY.top;         vy*=-1;     } else if (thumb.y >= boundsY.bottom) {         thumb.y=boundsY.bottom;         vy*=-1;     }     vx*=0.8;     vy*=0.8; }

actionscript3

get carriage return & line feed

By ranacseruet | Jul 4, 2009

How can I get the text from the textarea component along with the line feed & carriage return characters?

As now, I amusing the text to send email. But in email, it showing all in a line rather than multiline, which means carrriage return and/or line feed characters are missing. How can get them? Please help.

Regards

how i make this cod in as3???

By HHR | Jul 4, 2009
hi there
i have a cod whit _root.link in as2 but i wish to make this in as3.

ActionScript Code:
on (rollOver) {     if (_root.link != 1)     {         gotoAndPlay(this._target + “:s1″);             } } on (rollOut, releaseOutside) {     if (_root.link != 1)     {         gotoAndPlay(this._target + “:s2″);             } } on (release) {     if (_root.link != 1)     {         if (_root.link)         {             gotoAndPlay(_parent[“item” + _root.link] + “:s2″);                 }         _root.link = 1;     } }

I understand that _root in as3 it’s MovieClip(root). i make the change and put the function and EventListener for the button and replace _root with root….but dont work …
i need to have the last activiti of a button that when i press another button the primari button CLICKed to make a action ( roll out) and the second button CLICKed ..gotoAndPlay("label1")

i read that i need to make a array with my button menu and that to place a IF …..

here it’s the menu http://s3.envato.com/files/68395/index.html

© 2007 ActionScript 3.0