Tuesday, May 10, 2011
Thursday, May 5, 2011
Monday, May 2, 2011
WireParam As3
Thought on constrainable object structure:
You can have bound functions, but you cannot have bound properties.
That said, constraints should operate through bound functions
such as getX and setX.
This will enable "WireParameters" in flash like wireparameters in max.
You can have bound functions, but you cannot have bound properties.
That said, constraints should operate through bound functions
such as getX and setX.
This will enable "WireParameters" in flash like wireparameters in max.
Stacking Order / Draw Order Explained. AS3
Original Thread Link:
http://board.flashkit.com/board/showthread.php?t=771640
Post By:neznein9
Whenever you use addChild, the object is put on the top of the display list (highest z-index). You can use a couple different methods to manually set the index - also, remember that you have to use an index thats in bounds, you can only set an index to 100 if there are 100 other things on stage.
addChildAt(mc, 0); <= this will add to the back
addChildAt(mc, 10); <= this will add to layer 10 and bump anything already there
setChildIndex(mc, 20); <= this moves mc to index 20, bumping anything else
setChildIndex(mc, this.numChildren - 1); <= bring mc to the top
swapChildren(mc, mc2); <= switches the two
swapChildrenAt(0, 10); <= switches whatever is at 0 with whatever is at 10
http://board.flashkit.com/board/showthread.php?t=771640
Post By:neznein9
Whenever you use addChild, the object is put on the top of the display list (highest z-index). You can use a couple different methods to manually set the index - also, remember that you have to use an index thats in bounds, you can only set an index to 100 if there are 100 other things on stage.
addChildAt(mc, 0); <= this will add to the back
addChildAt(mc, 10); <= this will add to layer 10 and bump anything already there
setChildIndex(mc, 20); <= this moves mc to index 20, bumping anything else
setChildIndex(mc, this.numChildren - 1); <= bring mc to the top
swapChildren(mc, mc2); <= switches the two
swapChildrenAt(0, 10); <= switches whatever is at 0 with whatever is at 10
Sunday, May 1, 2011
Pass By Reference in AS3
Turns out, you can't do it.
Example:
Now, you are probably saying:
[1]: Why do this?
[2]: Why not use return value?
I wanted to make a function called: removeReferences.
Usage: removeReferences(theArray,theObject);
It would look for references of theObject in theArray and
set those references to null. Then the next pass would create a new
array where the null references would not be included.
Basically....
My function still works.... But it has to be called as such:
theArray = removeReferences(theArray,theObject);
Which to me is ugly ugly syntax.
It is akin to saying: theArray = theArray.push(theObject);
Unfortunately, all the other workarounds are even uglier...
Example:
var A1:Array = [1,2,3,4];
function theFunction(someArray:Array){
var otherArray:Array = [555,555,555];
someArray = otherArray;
}//[x]
theFunction(A1);
trace("A1==" + A1);
output:
A1==[1,2,3,4]
Now, you are probably saying:
[1]: Why do this?
[2]: Why not use return value?
I wanted to make a function called: removeReferences.
Usage: removeReferences(theArray,theObject);
It would look for references of theObject in theArray and
set those references to null. Then the next pass would create a new
array where the null references would not be included.
Basically....
My function still works.... But it has to be called as such:
theArray = removeReferences(theArray,theObject);
Which to me is ugly ugly syntax.
It is akin to saying: theArray = theArray.push(theObject);
Unfortunately, all the other workarounds are even uglier...
Resource Management time
http://gskinner.com/blog/archives/2006/06/as3_resource_ma.html
Todo: Learn how to completely remove movieclips from stage.
If I am going to make a particle that spawns other particles, that
could create huge memory leaks if I don't figure out resource management.
Todo: Learn how to completely remove movieclips from stage.
If I am going to make a particle that spawns other particles, that
could create huge memory leaks if I don't figure out resource management.
Subscribe to:
Posts (Atom)