Jump to content

Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Gabums's Achievements


Newbie (1/14)



  1. Hello all, I'm trying to add multiple images to a blank movie clip on my stage using the addChild method in an array. After many hours I got it almost working. The only problem now is that all of my arrayed images tween at the same time. They don't stagger. Is there any way to take the code that I have done and have each image tween, then the next, and so forth? I also need the timeline to repeat indefinately after all arrayed images have finished (which is why I have nested timelines). Thank you! var myTimelineCardMain:TimelineMax = new TimelineMax({repeat:-1}); var sArray:Array = [] var imgBD:BitmapData=new card_28(315,355); var card1:Bitmap=new Bitmap(imgBD); card1.x = -315; card1.y = -355; var img1BD:BitmapData=new card_21(315,355); var card2:Bitmap=new Bitmap(img1BD); card2.x = -315; card2.y = -355; sArray.push(card1,card2); for(var i:int = 0; i < sArray.length; i++) { card_main.addChild(sArray[i]); } var myTimelineCard:TimelineLite = new TimelineLite(); myTimelineCard.insertMultiple([new TweenLite(card_main, 0, {y:467, x:920}), new TweenLite(card_main, 3, {rotation:-9, ease:Back.easeOut}), new TweenLite(card_main, 3, {delay:3, rotation:200, ease:Back.easeOut})], 0, "sequence"); myTimelineCardMain.insertMultiple([myTimelineCard], 0, TweenAlign.SEQUENCE, 3);
  2. OMG! I can't thank you enough! You've been such a huge help for me this whole project! HUGE virtual HUG!!! gotoAndPlay(1) worked just dandy. Figures when I spend the past 3 hours trying to resolve the issue it was that simple. I'm gonna test it on all my usual browsers and operating systems just to be sure, but...it worked locally for me
  3. Sorry for the "ASAP" part but my project is supposed to go out today and I noticed a glitch which I cannot figure out. I have a loader: var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler}); queue.append(new SelfLoader(this, {name:"self"})); queue.append(new SWFLoader("title_mask.swf", {name:"title_mask", estimatedBytes:2196542, autoPlay:false})); //begin loading queue.load(); function progressHandler(event:LoaderEvent):void { var pcent:Number=event.target.progress*100; lbar.scaleX=pcent/100; lbc.text=int(pcent)+"%"; if(pcent == 100){ gotoAndPlay(2); } } and I have the code to make the title play later on: var LoaderContentTitle:ContentDisplay = LoaderMax.getContent("title_mask.swf"); title_show.addChild(LoaderContentTitle); LoaderMax.getLoader("title_mask.swf").rawContent.play(); Everything works as it should until you get to the end of my animation and there is a button that says "replay". Code as follows: replay_btn.addEventListener(MouseEvent.CLICK, replayButton); function replayButton(e:MouseEvent) { gotoAndPlay(2); SoundMixer.stopAll(); mainChannel = mainMusic.play(); } I tell it to go to and play frame 2 since frame 1 has the loader bar and such. When the animation replays the title_mask.swf flashes on for an instant and then plays itself out. If I tell the replay button to gotoandplay frame 1... I get all kinds of output errors specifically "cannot process a null object reference" but the title_mask.swf doesn't flash and plays as it should. Any thoughts???? Thanks so much! Gab UPDATE: I have this weird work around that I'm gonna use for now I think. If I can make it work better later I'll secretly swap out the files on the server So I added this code: LoaderMax.getLoader("title_mask.swf").unload(); var queue2:LoaderMax = new LoaderMax({name:"mainQueue2"}); queue2.append(new SWFLoader("title_mask.swf", {name:"title_mask", estimatedBytes:2196542, autoPlay:false})); //begin loading queue2.load(); So it removes my loaded swf after its done playing and then reloads it and keeps it waiting for the code to call it back to play when the animation is replayed. I keep getting that null object reference error, and I know if has to do with this line LoaderMax.getLoader("title_mask.swf").unload(); and I don't know why. But its working anyway... so i dunno...
  4. Hmmm that is really odd. Your animation worked for me as well. I guess I am not 100% positive the swfs are AS3. They were exported from After Effects (which is why they are so large and I'm loading them externally in the first place). I'll have to look into it some more. It is strange that AE 5.5 would export swfs in AS2 when AS3 is the new thing. Is there a work around if the swf's are AS2? Once again, I really really appreciate you taking the time to work on this with me. Thanks! UPDATE - I got it to work finally!!! I ended up taking my exported swf from After Effects and bringing it into flash, saving it as AS3. The code you provided me is now working perfectly. Thank you again for your time and patience!!!
  5. Sorry about that. Attached is the cs4 version. I think I see what you mean now, but I still can't seem to get it to run correctly. Even when I get it to load and play, it still ignores my "autoplay:false" command and plays before I even tell it to.
  6. Thank you for bearing with me...I'm sorry to be going all over the place here. I'm just trying any option I can think of and I guess it's becoming a mess. What I would like to do, and you are correct in your assumption, is load all my swfs and then later on, call an individual loaded swf to play. I already have empty movie clips made to put the loaded swfs in. This is where the "title_show" came in. So I took your previous code and changed it to this: LoaderMax.getLoader("title_mask").rawContent.play(); title_show.addChild(LoaderMax.getContent("title_mask")); (BTW - I changed the empty SWF to be called "title_show" instead of "title_mask" like I did in my previous posts since I thought it would be easier to tell what I was referring to this way) I see what you did with the code and I think I understand how it works, but it brings me back to my question at hand. You have this code: var LoaderContent:ContentDisplay = LoaderMax.getContent("loadSingleSwf_child.swf"); addChild(LoaderContent); LoaderMax.getLoader("loadSingleSwf_child.swf").rawContent.play(); Doesn't that do the same as this? var title_loader:Loader = new Loader(); var SWFtitle:URLRequest = new URLRequest("title_mask.swf"); var swf_title:MovieClip = new MovieClip(); title_loader.load(SWFtitle); swf_title.addChild(title_loader); title_show.addChild(swf_title); Both codes are not utilizing the already loaded swf correct? Your code calls "loadSingleSwf_child.swf" and mine calls "title_mask.swf"?? I attached a sample fla to show you what I'm working with. My code on the second frame has different versions that are commented out. If you un-comment them, you can see the errors I am getting. I really really appreciate your time with this. Thank you!
  7. Hmmm, I thought it would be something like that. I am getting an error though: Error #1069: Property play not found on flash.display.Loader and there is no default value. After looking through the forums some more, I found that someone else had that issue but it was resolved with them changing the AS code from 2 to 3. All of my swfs are in AS3 so that's not the problem. It was mentioned that there might be an issue with not having a crossdomain.xml file. Looking into what that is, it seems like that is for if your swfs are coming from different domains which mine are not. They are all on the same server in the same folder. Very confused If I change the code to this: LoaderMax.getLoader("title_mask").rawContent; title_show.addChild(LoaderMax.getContent("title_mask")); title_show.play(); It loads BUT the swf has already been completed and you don't see the animation. So it ignored the "autoplay:false" command in the loadermax. Very grrr Update - I just uploaded a crossdomain.xml file to my server and it is still not working... so that is probably not the issue then...right?
  8. Hello again, I have another question about this now that I'm looking over my code some more. So I have the loader set up: var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler}); queue.append(new SelfLoader(this, {name:"self", estimatedBytes:459403, autoPlay:false})); queue.append(new SWFLoader("snowfall.swf", {name:"snowfall", estimatedBytes:1324144, autoPlay:false})); queue.append(new SWFLoader("banner.swf", {name:"banner", estimatedBytes:461226, autoPlay:false})); queue.append(new SWFLoader("plane_lg.swf", {name:"plane_lg_swf", estimatedBytes:349347, autoPlay:false})); queue.append(new SWFLoader("title_mask.swf", {name:"title_mask", estimatedBytes:2202010, autoPlay:false})); //begin loading queue.load(); And then in order to have the swf play sometime in the future I have code such as this: var title_loader:Loader = new Loader(); var SWFtitle:URLRequest = new URLRequest("title_mask.swf"); var swf_title:MovieClip = new MovieClip(); title_loader.load(SWFtitle); swf_title.addChild(title_loader); title_mask.addChild(swf_title); The thing that is confusing me, and it all seems to be working fine I'm just trying to understand, when I set up the new URLRequest, aren't I calling the swf that isn't already loaded??? I mean, shouldn't I find a way to call my loaded swf from the loadermax --- ie - the name "title_mask" --- instead of calling the external swf itself. It would seem to me that this line: var SWFtitle:URLRequest = new URLRequest("title_mask.swf"); is not utilizing the fact that I have already preloaded the swf. Does this make sense? Am I doing this wrong or am I just over thinking this? Thanks again!
  9. Ah, ok... i guess I need to play around with using the stage X and Y positions then. Every time I have tried so far I keep getting an error that Stage isn't defined or something to that extent (I stopped working on it for the night so the error isn't in front of me). And yes, I decided not to use the code to make the snowball shoot through the target. It seems to make more sense to have it stop at the clicked point and then be removed. The other user, jgutherie, did need that code and I am glad that I was able to start the convo for them to get it. I really appreciate all the help you have been offering. Thank you!
  10. Hello again, Thank you so much for providing all your suggestions and code. I have my snowballs being thrown perfectly but now there is a weird glitch. I am trying to make it that when you click on a target, the snowball will hit it and then the target disappears. Trying to test out code to make that work is being hampered by the fact that every time I click my target movie clip, the snowball goes flying off to the side, it won't fly toward the target mc. The only bit of code I edited from what was suggested above is this: But i can't see why that would be a problem. Any ideas??? Thanks again!!! UPDATE: I just noticed that this is only a problem with movieclips NOT graphic symbols. Weird. UPDATE UPDATE: So I have a new theory. It almost seems like when I click my target mc, the mousePositionX and mousePositionY stop registering according to the stage but registers based on the smaller target mc dimensions. Could this be the case? If so, would I then have to define mousePositionX and mousePositionY based on the stage? This doesn't work but just an example: x:stage.mousePositionX, y:stage.mousePositionY
  11. On second thought...I can probably make use of the fact that the snowball stops where it does. So scratch that concern... If anyone has any thoughts on how to get the snowball follow the mouse click once and then on the next click make a new one...i'd be very appreciative of your help. Thanks again in advance!
  12. Hi All, Have another question for everyone. I'm now trying to create a snowball fight type game. I want it to play out where the user tries to click on a target and a snowball will come out from the bottom center of the screen and be "thrown" in the direction of the click. After spending hours trying to figure this out, I decided to try greensock tweens and it got me very close. Here is the code I am using: var Bullet:bullet = new bullet(); // define bullet start point and speed Bullet.speed = 3; Bullet.x = 360; Bullet.y = 400; addChild(Bullet); //declares variables var mousePositionX:Number = 0; var mousePositionY:Number = 0; //adds the event listener stage.addEventListener(MouseEvent.CLICK, onClickHandler, false, 0, true); //assigns variables and moves the object function onClickHandler(event:MouseEvent):void { mousePositionX = event.target.mouseX; mousePositionY = event.target.mouseY; TweenMax.to(Bullet, .5, {x:mousePositionX, y:mousePositionY}); } So right now that code tells my snowball to throw, but it just stops where the mouse click was. I need the snowball to continue its way out of the stage if it misses the target and stop if it hits it. Also, if I click multiple times on the stage, the snowball just follows my mouse (and not very accurately at that), if I click the stage again I want a new snowball to come out. Sooo... my questions are, in order of importance... 1.) Is this something the greensock code can do? Or do I need to look elsewhere still? 2.) How do I get it to extend past where the mouse click was? 3.) Is there a way to tell the snowball to just pay attention to the first click. And then each click after throws a new one? I feel like there is... like I need to nest the functions or call an array but I'm not sure how to handle that. Thank you again so much in advance!!!
  13. Thank you so much both of you for your kind words and help. I just downloaded a debugger for my flash projects since I had never used one before. I'm looking into that null object now. I know my swf files are huge, I was hoping that loading them first before playing would solve any lag time issues. I suppose not. I did switch some of the animations to be frame based and I see a huge difference in keeping the animations together. When I get a chance, I'm going to see about doing something like making just the propeller in AE and the rest vector. Perhaps that will help things along. For now though, I have a insanely ridiculous deadline of Friday to finish the rest of this up so I'll have to optimize later. Thank you again for your advice and recommendations. I'll be sure to post back if I get it resolved or not
  14. Thank you so much for taking the time to answer my questions. Here is a test link that shows the issue. http://www.inspiredbynight.com/holiday/ It basically starts when the title of the animation comes in, it looks like it hesitates briefly and then throws everything else off. I know that my swfs built in AE are fairly large (about 2 mb) so I wanted to make sure that all my swfs were loaded in advance before I played the main movie. Which is why I have a separate file to make sure all is loaded before the main movie plays. Here is the code for when my plane comes in: var TimeLinePlane:TimelineMax = new TimelineMax(); TimeLinePlane.append(new TweenLite(plane_lg_swf, 3, {x:-470, y:-40, scaleX:.5, scaleY:.5, onCompleteParams:["plane1"]})); TimeLinePlane.append(new TweenLite(plane_lg_swf, 3, {x:-1600, y:20, scaleX:1, scaleY:1, onCompleteParams:["plane2"]})); TimeLinePlane.append(new TweenLite(plane_lg_swf, 5, {delay:1, x:100, y:100, scaleX:.15, scaleY:.15, onCompleteParams:["plane3"]})); TimeLinePlane.append(new TweenLite(plane_lg_swf, 5, {delay:5, x:-100, y:-100, scaleX:.1, scaleY:.1, onCompleteParams:["plane4"]})); Perhaps it is reading the delay or the speed differently on different computers??? If the above is the case, is there a way to make my animations appear 2 seconds later to compensate for the 2 second lag? Thank you again!
  15. Hello all, I'm having a strange timing issue in my flash movie. I created some animations in After Effects and exported them as swfs. Then I set up code to load them in externally in my main movie. Here is an example of how I did one of them: //add title var title_loader:Loader = new Loader(); // URLRequest points to your external SWF var SWFtitle:URLRequest = new URLRequest("title_mask.swf"); //create the container Movie Clip to load swf var swf_title:MovieClip= new MovieClip(); title_loader.load(SWFtitle); //just add the loaded swf to container swf_title.addChild(title_loader); //add container to the stage and make it visible title_mask.addChild(swf_title); The problem is, when I test the movie on my computer it works fine, but when I put it up on the server or even send the swf to another computer, the timing gets all wacky. External swfs will get jumpy and then throw the timing off of the rest of the elements. Both my main movie and my external swfs from AE are 30 fps. I also set up code on a loader swf that will let my main swf play ONLY after all the rest of the swfs are loaded. Maybe I wrote that code wrong and thats why some of the swfs skip around? import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler}); queue.append(new SWFLoader("main.swf", {autoPlay:false})); queue.append(new SWFLoader("snowfall.swf", {autoPlay:false})); queue.append(new SWFLoader("plane_lg.swf", {autoPlay:false})); queue.append(new SWFLoader("title_mask.swf", {autoPlay:false})); //begin loading queue.load(); function progressHandler(event:LoaderEvent):void { var pcent:Number=event.target.progress*100; lbar.scaleX=pcent/100; lbc.text=int(pcent)+"%"; if(pcent == 100){ gotoAndPlay(2); //this line takes you to the next frame where my main swf gets loaded in and plays } } I am also using timelineMax and tweenMax...maybe sprinkled in with a little of the Lite versions. Would this be the cause of the adverse effects? Do I need to pick a type and stick with it, or do they mix and match ok? Any ideas or tips would be greatly appreciated. Thank you!