1 Replies - 16208 Views - Last Post: 10 May 2011 - 06:22 PM

#1 mjrdesign   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 10-May 11

AS2 - How to stop onEnterFrame after a few frames

Posted 10 May 2011 - 04:06 PM

How to stop onEnterFrame after a few frames. Here is the code I have, now after 30 frames how do I stop it?

var matrix_array:Array = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z", "?", "<", ">", "!", "`", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "+", "|", "/", "=", "_", ",", "[", "]", "{", "}", ":", ";");
onEnterFrame = function() {
//34 is teh position where characters or numbers can be found, these are required to set the color code
text_box.textColor = "0x00"+matrix_array[random(15)]+matrix_array[random(15)]+"00";
text_box.text = matrix_array[random(matrix_array.length)];
};

Is This A Good Question/Topic? 0
  • +

Replies To: AS2 - How to stop onEnterFrame after a few frames

#2 lordofduct   User is offline

  • I'm a cheeseburger
  • member icon


Reputation: 2668
  • View blog
  • Posts: 4,786
  • Joined: 24-September 10

Re: AS2 - How to stop onEnterFrame after a few frames

Posted 10 May 2011 - 06:22 PM

remove the function from the event

in AS2 if I remember correctly it's the 'delete' command:

delete onEnterFrame;



In AS3 it's

removeEventListener(Event.ENTER_FRAME, theFunction);





try using AS3, it can be faster and more powerful in the end. That and finding help is becoming far easier for AS3 than AS2.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1