Jump to content
Search Community

Waskom

Members
  • Posts

    4
  • Joined

  • Last visited

Waskom's Achievements

1

Reputation

  1. The problem with i*.5 is when a item further down the list is selected. exp: If item 26 is selected, its going to wait 13 seconds before moving the 1st line. Yes, once it does start to move it will create the animation i want, but it will have a very long initial delay if an item further down the list is chosen. /// That whole scenario put me on track to figure it out: var k:Number = 0; for(var i:int = 1; i<QuestionArray.length; i++) { if(i>=QBarSpotHolder) { trace("k = "+k); TweenLite.to(QuestionArray[i], .5, {delay:k, y:"-30", ease:Back.easeIn}) k = k +.25; } } I declared k before the loop, everytime an item is removed, it calls this function so this will keep k set to 0 at the beginning. I then use k as the amount to delay by and add .25 every time the loop runs. this works, but it feels like a work-around to me. Forgive my inexperience, but is this normal? or is there a more "proper" way to do this?
  2. I tired to do a search for this, but i think my search skills are under-par. apologies if this has already been answered. I have a movieclip that has a series of smaller movieclips created inside of it. These movie clips are in an array: QuestionArray. The user can select one of the movieclips in QuestionArray and choose to delete them. When they do the movieclips below the deleted one moves up and the array is spliced. I can make this work. with the following: function Remove_QBar (e:MouseEvent) { QSpot--; QBarSpotHolder = Get_Index_By_Name(QuestionArray, QBarSelected) QuizHolder.NewQuestion.QBarHolder.removeChild(QuestionArray[QBarSpotHolder]); QuestionArray.splice(QBarSpotHolder,1) for(var i:int = 1; i<QuestionArray.length; i++) { if(i>=QBarSpotHolder) { TweenLite.to(QuestionArray[i], .5, {delay:.25, y:"-30", ease:Back.easeIn}) } } } This works, but becuase of how fast the loop executes, all the movie clips virtually move at the same time, regardless of the delay: attribute added to the tweenlite.to. I would like them to move one after the other. Is there a way for me to force this delay inside the loops. I would also like to use a loop, the movieclips are created by the user and can range from 1 to 50. so manually typing them out is not possible because it will be unknown how many there will be in the array. thanks,
  3. That makes perfect sense. I moved the declaration outside the function and it all works now. thank you very much!
  4. Hello all, Just recently got TweenLite/Max and am still new to it. So this may be an oversight on my part. I am creating a movie clip and using it as a button. When the button is clicked it creates a box(movie clip), inside the box is a series of bars(each one a movie clip). The box is then tween down in a simple animation. If the button is clicked again, it raises the box. If the button is clicked again it lowers the box. There is a check when the button is clicked to see if the box has already been created. If it has, then it skips that part and either raises or lowers it based on its current state. The button creates fine, it will create the box and bars, and lower it all just fine. But when i click the button again, to raise the box, i get: TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.greensock::TweenLite/render() at com.greensock.core::SimpleTimeline/render() at com.greensock.core::Animation$/_updateRoot() It will continuously create this error as if it stuck in a loop. I ran the debugger and got: Error: Cannot tween a null object. Duration: 1, data: undefined at com.greensock::TweenLite()[C:\...\com\greensock\TweenLite.as:448] at com.greensock::TweenLite$/to()[C:\...\com\greensock\TweenLite.as:910] at TrainingModulev2_fla::MainTimeline/Index_Drop()[TrainingModulev2_fla.MainTimeline::frame1:146] Frame1:146 is the 4th from last line in my code below.( TweenLite.to(IndexBox, 1, {delay:0, y:58}); ) My code: function Index_Button() { var IndexButton:MC_IndexButton = new MC_IndexButton ; addChild(IndexButton); IndexButton.x = -50; IndexButton.y = 110; IndexButton.alpha = 0; TweenLite.to(IndexButton, 1, {x:1, alpha:1}); IndexButton.addEventListener(MouseEvent.CLICK, Index_Drop); } function Index_Drop(e:MouseEvent) { if (IndexDown==true) { TweenLite.to(IndexBox, 1, {y:"-58"}); IndexDown = false; } else if (IndexCreated == false) { var IndexBox:MC_IndexBox = new MC_IndexBox ; addChild(IndexBox); IndexBox.x = 0; IndexBox.y = -184.5; var IndexBarArray:Array = []; for (i=1; i<8; i++) { IndexBarArray[i] = new MC_IndexBar ; IndexBarArray[i].name = "IndexBar" + i; IndexBox.addChild(IndexBarArray[i]); IndexBarArray[i].x = 14; IndexBarArray[i].y = i * 27 + 72; IndexBarArray[i].addEventListener(MouseEvent.MOUSE_OVER, IndexBar_Over); IndexBarArray[i].addEventListener(MouseEvent.MOUSE_OUT, IndexBar_Out); } setChildIndex(IndexBox, 2); IndexCreated = true; TweenLite.to(IndexBox, 1, {delay:0, y:58}); } else { TweenLite.to(IndexBox, 1, {delay:0, y:58}); IndexDown = true; } } I cant figure out what im doin wrong. From what i am understanding, That line isnt ran until after IndexBox is created. I know its there, I've targeted it a few times in the code. I can see it when i run a test. thanks
×
×
  • Create New...