-
1. Re: Trying to dynamically Rotate a Dynamically Created Movie Clip
Ned Murphy Jun 9, 2013 6:00 PM (in response to Departure)You'll need to show more of your code to support your saying "nothing happens though". Setting the rotation property to be 90 should work. Try showing a simplified version of the code whith something to show for the electron object that supports your saying it is not rotated when the createElectron function is done with it.
The function is passed a reference to the electron so is does not need to return it. The function will target the electron that you created in the first line.
-
2. Re: Trying to dynamically Rotate a Dynamically Created Movie Clip
Departure Jun 9, 2013 10:10 PM (in response to Ned Murphy)var electronsH:Array=new Array
var electron:Sprite = new Sprite();
buildElectronBeam(8,50,50)
function buildElectronBeam(atom,repeatHorizontal,wide)
{
For loop{
var electron2:Sprite = new Sprite();
singleElectron(radius,4,electron2) // here i send electron2 to be animated and built up in the called function
electron2.rotation=90 // This does rotate the electron but not the animation defined for it.
electronsH[h]= electron2
addChild(electronsH[h]) // shows that animation is still horizontal
}
}
function singleElectron(radius,pixel,electron:Sprite)
{
createPoint(pixel)
function createPoint(radio:uint)
{
electron.graphics.beginFill(0xFFFFFF,1)
electron.graphics.drawRect(0,0,pixel,pixel)
addChild(electron)
electron.addEventListener(Event.ENTER_FRAME, movepixels)
}
function Animatepixels(e:Event)
{ pixel starts to spin on a horizontal line}
}
I think my problem is I dont know how to attach this animation to be part of the MovieClip so i Can rotate the whole thing. What i was trying to achieve here is to say flash "Consider whatever going on in this singleElectron function as my MovieClip" but as we both see, electron is the movieClip and animate function just performs something without being a part of MovieClip itself.
-
3. Re: Trying to dynamically Rotate a Dynamically Created Movie Clip
moccamaximum Jun 9, 2013 11:44 PM (in response to Departure)Are you using a motion tween to do your animation, besides the enter frame function?
-
4. Re: Trying to dynamically Rotate a Dynamically Created Movie Clip
Departure Jun 10, 2013 1:22 PM (in response to moccamaximum)@Moccamaximum
No instance or symbol created...No animation on timeline. The code is placed on first frame of the Stage.
I do not want to use TWEEN class because i m defining my own patters for animating the .x and .y properties of Electron. As you noticed, the Animate function here is still detached from the electron movieClip and the quest is to how make this animation an attached motion of the movie clip so the whole thing can be rotated together.




