sylvainhugues
05-06-2008, 10:59 PM
Hi !
I was a king of AS2, I'm learning AS3 and I have to tell myself : "Don't panic, don't go back to AS2"...
Even the basic action are nightmares to programm.
After reading and viewing a lot of stuff on AS3, I still mostly don't understand this Object principle.
Exemple 1 :
I want to move horizontaly an embed MC into an other MC. (I idon't want to use addChild, I manually put them on Stage)
It would be : container.Mc.x=10;
It doesn't work because Flash thinks Mc is a property.
How the hell could I do that ? Using Class ??!! How ?
(a unique MC works perfectly : container.x=10;)
Example 2 :
I want to change the depth of a MC (animated) manualy added on stage.
swapDepths() is no longer available, so I have to write about ten lines (thanx) with setChildIndex or this kind of method :
////////////////////
import flash.display.MovieClip;
var container:MovieClip = new MovieClip();
container.addChild(Mc);
addChild(container);
function fnChangerProfondeur(paramMc:MovieClip,):void {
var varProfondeur:int
varProfondeur = container.numChildren - 1
container.setChildIndex(paramMc, varProfondeur);
}
fnChangerProfondeur(Mc)
////////////////////////
Depth switching works fine but the manual tween animation of my elements doens't work anymore, even if I force with play()
It appears but does'nt move.
I'm a designer who like to code AS, but I think I'm gonna give up with AS3, I'm not a C++ nerd, I' m sad.
Thank for your responses.
I was a king of AS2, I'm learning AS3 and I have to tell myself : "Don't panic, don't go back to AS2"...
Even the basic action are nightmares to programm.
After reading and viewing a lot of stuff on AS3, I still mostly don't understand this Object principle.
Exemple 1 :
I want to move horizontaly an embed MC into an other MC. (I idon't want to use addChild, I manually put them on Stage)
It would be : container.Mc.x=10;
It doesn't work because Flash thinks Mc is a property.
How the hell could I do that ? Using Class ??!! How ?
(a unique MC works perfectly : container.x=10;)
Example 2 :
I want to change the depth of a MC (animated) manualy added on stage.
swapDepths() is no longer available, so I have to write about ten lines (thanx) with setChildIndex or this kind of method :
////////////////////
import flash.display.MovieClip;
var container:MovieClip = new MovieClip();
container.addChild(Mc);
addChild(container);
function fnChangerProfondeur(paramMc:MovieClip,):void {
var varProfondeur:int
varProfondeur = container.numChildren - 1
container.setChildIndex(paramMc, varProfondeur);
}
fnChangerProfondeur(Mc)
////////////////////////
Depth switching works fine but the manual tween animation of my elements doens't work anymore, even if I force with play()
It appears but does'nt move.
I'm a designer who like to code AS, but I think I'm gonna give up with AS3, I'm not a C++ nerd, I' m sad.
Thank for your responses.