(EDIT) Woops, figured it out. I forgot I had the class below as the doc class. I had another class called Ball which defined public variables vx and vy (as a Number data type).
For the thread's sake though, the question still stands. I've looked up whether you can create custom properties but had no luck. Code:
I have this code inside a function that I'm following for a tutorial:
Code:
balls = new Array();
for(var i:int = 0; i < count; i++)
{
var ball:Ball = new Ball(5);
ball.x = Math.random() * stage.stageWidth/2;
ball.y = Math.random() * stage.stageHeight;
ball.vx = Math.random() * 2 - 1;
ball.vy = Math.random() * -10 - 10;
However, I've high-lighted the .vx and .vy properties because the terms do not turn blue like the .x and .y properties (or like any other term that's in the AS 3.0 library).
Is it similar to creating a variable? I later apply the properties like this:
Code:
ball.vy += gravity
ball.x += ball.vx;
ball.y += ball.vy;
In previous tutorials, I just learned to create and assign variables vx and vy a value then apply
Code:
ball.x += vx and ball.y +=vy
can you create custom properties?
Wednesday, June 20, 2012
[Action Script] can you create custom properties? June,2012
Posted by Bimo Hery Prabowo at 3:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment