Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

from as2 to as3

Participant ,
Mar 20, 2019 Mar 20, 2019

function standUp(target:MovieClip,delay:Number):Void{

target.interval=function(){

target._visible=true;

clearInterval(target.intervalID);

this.onEnterFrame=function(){

target._xscale=target._yscale-=25;

target._y-=(target._y-target.startY)/3;

if(Math.abs(target._y-target.startY)<1){

target._y=target.startY;

delete target.onEnterFrame;

}

};

};

target.intervalID=setInterval(target,"interval",delay);

target._xscale=target._yscale=400;

target.startY=target._y;

target._y=0;

target._visible=false;

};

/*function typewriter(target:MovieClip,delay:Number):Void{

target.interval=function(){

target._visible=true;

keyHit.start(0,1);

clearInterval(target.intervalID);

};

target.intervalID=setInterval(target,"interval",delay);

target._visible=false;

}

*/

function placeText(target:MovieClip,x:Number,y:Number,

  banner:String,tFormat:TextFormat,effectFunction:Function,delay:Number):Void{

//for each character

for(var i=0;i<banner.length;i++){

//create clip put each character in it

var char:MovieClip=target.attachMovie("letter","char"+i,target.getNextHighestDepth());

char.field.text=banner.substr(i,1);

char._x=x;

char._y=y;

//add the width of current text character to next char's x position-

x+=tFormat.getTextExtent(char.field.text).width;

//effect function call-passed in as a param

effectFunction(char,i*delay);

//delay between typing here-

//var timer=i*200+Math.round(Math.random()*200);

//typewriter(char,timer);

}

}

//var keyHit=new Sound(this);

//keyHit.attachSound("click");

var format:TextFormat=new TextFormat;

format.font="Arial";

format.size=24;

placeText(this,100,100,"Create EASY text animations",format,standUp,100);

placeText(this,100,120,"using only actionscript",format,standUp,100);

nextFrame();

Above how do I change this to Actionscript 3.0 from Actionscript 2.0  In bold I want a change to but how do I that. So please help me with it.

TOPICS
ActionScript
637
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 08, 2019 May 08, 2019

instead of onEnterFrame and delete onEnterFrame use addEventListener(Event.ENTER_FRAME,functionname) and removeEventListener(Event.ENTER_FRAME,functionname)

setInterval you can use with as3, but like as2, you should clear the interval before creating to prevent duplicate/runaway intervals.

instead of attachMovie, use the 'new' constuctor:

var char:MovieClip=new letter();

addChild(char)

car.field.text-banner.substr(i,1);

there's no direct conversion for getTextExtent.  you could create a custom functio

...
Translate
Community Expert ,
May 08, 2019 May 08, 2019

instead of onEnterFrame and delete onEnterFrame use addEventListener(Event.ENTER_FRAME,functionname) and removeEventListener(Event.ENTER_FRAME,functionname)

setInterval you can use with as3, but like as2, you should clear the interval before creating to prevent duplicate/runaway intervals.

instead of attachMovie, use the 'new' constuctor:

var char:MovieClip=new letter();

addChild(char)

car.field.text-banner.substr(i,1);

there's no direct conversion for getTextExtent.  you could create a custom function that would return what you want though that would require intermediate to advanced coding skills.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 13, 2019 May 13, 2019

Thanks for answering my help and this correctly

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 13, 2019 May 13, 2019
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines