Jump to content
GreenSock

Esseti

Members
  • Posts

    13
  • Joined

  • Last visited

Reputation

0 Newbie
  1. Hello. Simple example: I want to load an external image (one that is in the same place as the swf that is running) with ImageLoader, and I want the loaded image to be smoothed, because I want to animate it smoothly, and not skip by 1px. Problem: When I run the code below, it doesn't work. import com.greensock.TweenLite; import com.greensock.loading.ImageLoader; import com.greensock.events.LoaderEvent; var il:ImageLoader = new ImageLoader("image.jpg", {smoothing: true, onComplete: ilComplete, container:this}); il.load(); function ilComplete(e:LoaderEvent):void { trace("loaded"); TweenLite.to(e.target.content, 10, {x:10}); TweenLite.to(img, 10, {x:10}); // img is an instance of the same image added on stage, and set Smoothing: on in the library } http://yz.pl/bohner/misc/imgloader-smoothing.html I've read the docs, smoothings should be set by default to true, but it doesn't work. I've read that it might be a crossdomain issue, but I don't load it from another domain. I've made the xml anyway, but still, doesn't work. I've also read the forums, but didn't find a solution for this problem. Any ideas?
  2. I'm a little confused on the caching of Video in Flash. I have an intro in *.mp4 format which I load with VideoLoader at my site, but I've noticed that even if I preload it once at 100%, the next time I open the site (remotely) it preloads again. I have no anti-caching systems of my own, and I tried to set the videoLoader.noCache = false; but it doesn't seem to do anything. Is it just the way browsers cache video, in that they don't store it in cache?
  3. AWESOME it works! Here's the code for future reference. import com.greensock.loading.VideoLoader; import flash.events.StageVideoAvailabilityEvent; import flash.media.StageVideoAvailability; import flash.media.StageVideo; stage.align = StageAlign.TOP_LEFT; var stageVideo:StageVideo; var videoLoader:VideoLoader; stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, checkVideoMode); function checkVideoMode(e:StageVideoAvailabilityEvent):void { e.target.removeEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, checkVideoMode); var sv:Boolean = e.availability == StageVideoAvailability.AVAILABLE; if (sv) { setStageVideo(); } else { setVideo(); } } function setStageVideo():void { var v:Vector.<StageVideo> = stage.stageVideos; stageVideo = v[0]; stageVideo.viewPort = new Rectangle(0, 0, 1280, 720); videoLoader = new VideoLoader("video/trailer.mp4", {container:this, width:1280, height:720}); videoLoader.stageVideo = stageVideo; videoLoader.load(); } function setVideo():void { videoLoader = new VideoLoader("video/trailer.mp4", {container:this, width:1280, height:720}); videoLoader.load(); } And remember, thatn StageVideo won't work in Flash IDE Debug, and you have to set wmode="direct" in your html template.
  4. It does support it, because it was working when I was loading the video with standard NetConnection and NetStream. I've made a small example of what is going on. import com.greensock.loading.LoaderMax; import com.greensock.events.LoaderEvent; import com.greensock.loading.VideoLoader; import com.junkbyte.console.Cc; import flash.events.StageVideoAvailabilityEvent; import flash.media.StageVideoAvailability; import flash.media.StageVideo; import flash.net.NetStream; stage.align = StageAlign.TOP_LEFT; Cc.startOnStage(this, ""); var stageVideo:StageVideo; var videoLoader:VideoLoader; stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, checkVideoMode); function checkVideoMode(e:StageVideoAvailabilityEvent):void { e.target.removeEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, checkVideoMode); var sv:Boolean = e.availability == StageVideoAvailability.AVAILABLE; if (sv) { Cc.log("STAGE_VIDEO"); setStageVideo(); } else { Cc.log("VIDEO"); setVideo(); } } function setStageVideo():void { videoLoader = new VideoLoader("video/trailer.mp4", {container:this, width:1280, height:720}); videoLoader.load(); videoLoader.content.x = 300; var v:Vector.<StageVideo> = stage.stageVideos; stageVideo = v[0]; stageVideo.viewPort = new Rectangle(0, 0, 1280, 720); stageVideo.attachNetStream(videoLoader.netStream); } function setVideo():void { videoLoader = new VideoLoader("video/trailer.mp4", {container:this, width:1280, height:720}); videoLoader.load(); } Source files - http://malylink.pdg.pl/misc/example.rar #WARNING: you must run this in a browser, because StageVideo will never work in Flash IDE. When you run this in the browser, it will detect that it can handle StageVideo, and will run the setStageVideo(), and the code there for StageVideo works, if the NetStream is setup by the old method. But by passing the videoLoader.netStream to the stageVideo.attachNetStream(); it doesn't work. When you run this, there will be video playing, but in Video() mode from the VideoLoader class., not from the code that I've written below the videoLoader. I've offsetted the videoLoader.x by 300px, so that you could see if there is video loaded to the stageVideo object.
  5. Hi. I've been trying to replace the default way of loading video in my website by NetConnections and NetStreams with LoaderMax, and it works great, but I also want to use StageVideo if the user can run it. Could anyone write a quick tutorial on how to use LoaderMax just to load the data (becase now it also automatically creates a sprite and displays the video with the new Video(); class, which is CPU heavy), and attach it to my StageVideo object? I know that there is a myVideoLoader.netStream property, but when I attach it with myStageVideo.attachNetStream(myVideoLoader.netStream); it doesn't work. Thanks.
  6. Never mind, bezierThrough already does it. Stupid me
  7. How to calculate the anchor point of a A->B bezierThrough tween, so that it is properly 'bent' for the next tween from B->C ? It's hard to explain, but I wan't to achieve smooth motion between multiple succeeding points.
  8. I thought about it a little more, and I found a way to separate the images into their own symbols. Thanks for the help though!
  9. Setup: A bitmap with a: - random 0-255 red rectangle - random 0-255 green rectangle - random 0-255 blue rectangle Is there a way to apply a color transform the bitmap, so that I can change every objects color individually ? For instance: - red rectangle to a random RGB color (not only R) - green to a random RGB color ... - blue etc...
  10. Great, thank you for the help!
  11. TweenMax.allTo([mc0, mc1, mc2], 1, {alpha:0, onStart: function() { * } }); * - is there a way to refer to the tweens target inside of allTo? Like in a addEventListener scenario, when you call: e.target
  12. Great, thanks. And happy new year
  13. Example scenario: I have 10 squares randomly placed on the scene. How can animate their y value by adding '24' with allTo? I don't want to animate them to y:24 (absolute), just add +24 in 'y' to each of their values. TweenMax.allTo(mySquaresArray, 1, {y: ???});
×