Jump to content
Search Community

Carl last won the day on December 24 2023

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,823
  • Joined

  • Last visited

  • Days Won

    546

Everything posted by Carl

  1. i'm sorry that my first reply didn't help more. it was a bit late here and I may have rushed through the reading. anyway, I have another sample for you which allows you to have precise control. take a look: http://www.snorkl.tv/dev/scrollRect/scrollMask.html basically there is a sprite that contains an image and mask. the image can be tweened within the masked area. furthermore you can scale the container, so while the whole mask reveal animation is happening, you can scale or slide the whole thing around. import com.greensock.*; import com.greensock.plugins.*; import flash.display.Sprite; import flash.display.MovieClip; import flash.display.Shape; TweenPlugin.activate([scrollRectPlugin]); //linkage set in library of simple mc with bitmap inside var mc:MovieClip = new MyImage(); //create container sprite to hold the image and the mask var container:Sprite = new Sprite(); //put the mc in the container container.addChild(mc); //put the container on stage addChild(container); //create a mask to reveal the image inside container var maskSprite:Sprite = new Sprite(); //make the mask a little smaller than the image var newRect:Shape = getRectangle(mc.width, mc.height*.5, 0xff0000) maskSprite.addChild(newRect) //center the container container.x = stage.stageWidth * .5 - ( maskSprite.width * .5); container.y = stage.stageHeight * .5 - ( maskSprite.height * .5); container.addChild(maskSprite); container.mask = maskSprite; function getRectangle(width, height, color):Shape{ var child:Shape = new Shape(); child.graphics.beginFill(color); child.graphics.drawRect(0, 0, width, height); child.graphics.endFill(); return child; } //tween the mc being revealed by the mask TweenMax.to(mc, 3, {y:-mc.height*.5, repeat:-1, yoyo:true}) //scale the whole container and its contents TweenMax.from(container, 3, {scaleX:.5, scaleY:.5, x:200, repeat:-1, yoyo:true}); I find it easier some times to provide something that I know will work than to find exact errors in other people's code. I think your latest example is giving you trouble because you are mixing and matching masking with scrollRect plugin. I think you can do exactly what you want with just a mask. Let me know if this seems like a better solution. Carl fla here http://www.snorkl.tv/dev/scrollRect/scrollMask.fla
  2. this example http://www.snorkl.tv/dev/scrollRect/ was built with only this code... no masks import com.greensock.*; import com.greensock.plugins.*; TweenPlugin.activate([scrollRectPlugin]); TweenMax.to(mc, 3, {scrollRect:{ top:-mc.height, bottom:0}, repeat:-1, yoyo:true}); i don't know if I am understanding the animation you want completely but you should be able to tweak to suit your needs fla attached
  3. That's a nifty trick. very cool. thanks!
  4. Hey Vyger, Sorry to hear you are having such troubles. From what I can see, you aren't doing anything wrong and it all should work. I followed the same steps and zipped my files for you to test. I know what I'm providing does work and uses the exact same code so let's see if it works for you. Carl ps. I totally overlooked that you had the xml and swf stuff commented out in your first post. my bad. EDIT: FILES NOW ATTACHED FLASH CS5 with COM
  5. Hi Matt, I don't know if this is totally accurate but here is my take. the load = false property I believe only is taken into consideration when the XMLLoader is first loaded. if at some point you you tell mainloadermax to load... all of its children will probably load with it regardless if they have load = false. if you want to load mainLoaderMax without loading the subloaders restructuring your xml may do it [item1 I want loaded with mainloadermax] [item2 I want loaded with mainloadermax] [item3 I want loaded with subloadermax1] [item4 I want loaded with subloadermax1] [item5 I want loaded with subloadermax2] [item6 I want loaded with subloadermax2] you can still load the other subloadermaxes at any time with: LoaderMax.getLoader("subloadermax2").load(); does that do what you want?
  6. I don't have a definitive answer for you but did you try using the content instead of rawContent? _assetCache[assetId] = LoaderMax.getContent(assetId) /// if you temporarily remove LoaderMax from the mix and just use a regular AS3 loader will it work? This will at least help to see if it is a LoaderMax issue or something with the duplicate script. ///
  7. nothing is jumping out at me as being wrong. i did a simplified approach of running 2 consecutive tweens TweenMax.to(mc, 1, {colorMatrixFilter:{colorize:0xff0000, amount:1}}); TweenMax.to(mc, 1, {colorMatrixFilter:{ amount:0}, delay:1.2}); and it worked fine as shown and also when i had the colorize prop in the second tween.
  8. Hi Martis, that solution looks real solid. I don't think there is really an "official" way to do something like that, so if it works for you I would say stick with it. I have 2 tutorials that might help you with navigating through TimelineMax based animation: 1: This tutorial is based on the way the greensock homepage animation was built with each section or slide of animation being in a separate class file. each section shares similar animateIn and animateOut methods so it makes it real easy to chain them all together into 1 sequence: http://www.snorkl.tv/2011/05/real-world ... ase-study/ 2: This tutorial focuses on adding really smooth transitions between sections. http://www.snorkl.tv/2011/03/teaser-bul ... ansitions/ if you combined these 2 tutorials with your dynamic merge maneuver you could have something really neat.
  9. do you have photo1.jpg in the same directory as your fla? how about the other files like xml/doc.xml or swf.main.swf? I would suggest only testing the first part of the code and getting it to work. 1:place a jpg named photo1.jpg in the same directory as your fla swf and com folder. 2: use just this code: import com.greensock.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.*; //create an ImageLoader: THROWS ERROR var loader:ImageLoader = new ImageLoader("photo1.jpg",{name:"photo1",container:this,x:180,y:100,width:200,height:150,scaleMode:"proportionalInside",centerRegistration:true,onComplete:onImageLoad}); //begin loading: THROWS ERROR loader.load(); //when the image loads, fade it in from alpha:0 using TweenLite; function onImageLoad(event:LoaderEvent):void { TweenLite.from(event.target.content, 1, {alpha:0}); } let us know if that works. if you get errors. please post the complete error. they contain line numbers and descriptions that will help us trouble shoot your issue.
  10. there is no limit set on how robust the equation is for determining a value inside a tween. did you get errors? you could do something like this TweenMax.fromTo(PortFolio_mc, 5, {x:980, y:410, alpha:.5}, {x:stage.stageWidth/2-PortFolio_mc.width/2-180:, y:stage.stageHeight/2-PortFolio_mc.height/2, alpha:1, delay:3, ease:Strong.easeOut}); or once it gets unreadable most people would probably create a var as an easier way to reference a value based on a big equation. var myY:Number = stage.stageHeight/2-PortFolio_mc.height/2; TweenLite.to(mc, 1, {y:myY});
  11. Hey Dominik, glad you found your answer, thanks for posting it. when checking my forum message yesterday on my little phone all I saw was: and I thought you were finished. totally missed the new problem. -carl
  12. the reason you can't access image_mc "later on" in your code is because you declare the image_mc var inside of a function. when you do that the term image_mc can only be used inside that function. this article on Variable Scope explains this issue in further detail: http://help.adobe.com/en_US/ActionScrip ... 90204-7f8c if you want to unload an image that LoaderMax has previously loaded, you can access it similar to the way that you did when you first defined image_mc. each loader's content has a reference to its loader so you could do: LoaderMax.getContent("childClip2").loader.unload(); or you could get to the loader more directly with: LoaderMax.getLoader("childClip2").unload(); likewise to add previously loaded image to the display list addChild(LoaderMax.getContent("childClip2")); does that help?
  13. hi dominik, it appears the version you posted is working as expected. the assets load, the lighbox effect kicks in, the animation plays, then the lightbox fades away. If you want to post your files, I can give them a test, but as I'm understanding it... you only get the wrong results some of the time on a certain computer? -carl
  14. you probably are better off re-doing it, but i didn't say there was no way, its just that I don't know. if you are handy with the various timelineMax methods like getChildren(), shiftChildren(), invalidate() and TweenMax methods like updateTo, its very possible that you could loop through the timeline, find the tweens you are after and try to re-record destination values and start values. by the time you did all that do, you could probably do it in a cleaner fashion. -carl
  15. to load the data, its pretty straight forward with a DataLoader: http://www.greensock.com/as/docs/tween/ ... oader.html import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; //create a DataLoader //change sample.json to url/name of your json file var jsonLoader:DataLoader = new DataLoader("sample.json", {onComplete:showJson}); //load the data jsonLoader.load(); //when file is loaded this function will run function showJson(e:LoaderEvent):void{ //will display the contents of your file in the output window trace(e.target.content); } as far as parsing JSON goes, I don't even know if there is any native AS3 support for that. I think there are some tools out there for it. LoaderMax will load it no problem. Once its loaded you will have to devise a way to get the info you need out of it.
  16. Sorry, I can't think of a way to do that. Doesn't mean it isn't possible. I would probably just create a tween/timeline at the time you want the button to reappear with the correct values instead of reversing. another possibility could be to have a series of tweens in one timeline that tweens from startPos to rollOverPos (when rollOver occurs) tweens from rollOverPos to offStagePos (when click occurs) tweens from offStagePos to start pos. (when re-appear requested) these could all be achieved with a tweenFromTo on a TimelineMax http://www.greensock.com/as/docs/tween/ ... eenFromTo() in this scenario to achieve smooth continuous tweens you would have to prevent clicking during the first segment and prevent re-appear during the second. being that I can't visualize the exact animations and interactions, i'm not sure this is a great suggestion.
  17. i didn't see any errors in the code above and even tested it with my own swf and it works great.
  18. I'm pretty sure the problem is that your tween is in a function that is an ENTER_FRAME handler let's say your frame rate is 30 frames per second. well that means that 30 times per second you are generating a new tween and constantly re-setting the alpha of your object to 0. the tween has a duration of 1 second, but as soon as it starts to run... it gets overwritten the next time an ENTER_FRAME event fires... 1/30th of a second later.
  19. ok, the file helped and so did your very clear explanation. I found some of the problems. as I noted previously, using restart() instead of play() will solve some of the issues, here is why: in your openFood do this: function openFood(event:MouseEvent):void{ trace("open food"); trace(food.currentProgress); food.play(); food_b.removeEventListener(MouseEvent.MOUSE_UP, openFood); } note the currentProgress. go through these steps click on food click on winelist click on home click on food notice the food.currentProgress = 1? that means the timeline is finished. calling play() does not start it from the beginning so you need restart() change your open food to: function openFood(event:MouseEvent):void{ trace("open food"); trace(food.currentProgress); food.restart(); food_b.removeEventListener(MouseEvent.MOUSE_UP, openFood); } now test click on food click on winelist click on home click on food it works! the problem is your closeWineFood timeline is NOT reversing wine or food. they stay "completed" so when you go to play them again (if not using restart) they don't work. you will see the same issue exists with openWine add the follwing traces to openWine: function openWine(event:MouseEvent):void{ trace("openWine "); trace("wine.currentProgress = " + wine.currentProgress); food.stop(); wine.play(); wine_b.removeEventListener(MouseEvent.MOUSE_UP, openWine); food_b.removeEventListener(MouseEvent.MOUSE_UP, closeFood); home_b.removeEventListener(MouseEvent.MOUSE_UP, closeFood); } click on food click on winelist click on home click on food click on winelist winelist won't open because its currentProgress is 1. change wine.play() to wine.restart() in openWine and it will work. ---------------
  20. you can zip up the fla and post it.
  21. if you go to http://www.greensock.com/loadermax/ and read the faq #9, there is a link to download the demo files. I believe those files contain the animation you are talking about.
  22. can you please describe the scenario you have where 2 separate loaders will load the same asset? it is very reasonable that people may want to load the same swf or image twice for 2 different purposes and in that case LoaderMax will not cancel or disrupt the process of another loader that requests that asset. this is the expected behavior. if your application has various ways in which people can request a particular image, you should only have one ImageLoader for that image if you want it to load only once. does that make sense? ----- as for your question about ContentDisplay I really don't know.
  23. i don't know why there is a green screen. it shouldn't be there unless you specified it somehow. did you set a background color to a loader or is it in one of your symbols? also VideoLoaders have a bgColor and bgAlpha (check docs) maybe you activated one of those? i imagine having one video would cure the issue.
  24. it would help if you would post all your code as it is now. there is no way for anyone to diagnose that problem without seeing it.
  25. that's a lot of code to digest. are you talking about the onComplete listeners not working or your buttons? have you tried putting traces in your listener functions to verify that they are being fired? also, if your timeline's simply aren't playing when you click buttons you could try restart().
×
×
  • Create New...