Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Zync

  1. The best way would be to load your swf into an empty movieclip or sprite. Load stuff directly to the stage (while that works just fine) I've always found it to be less convenient and harder to manage than if it was just in its own empty container. Then depending on what you call the container, you can use the While loop. And hey ya Carl, yeah its been a while. Finally back from holiday and really want to start getting some game tuts out again for 'gaming with greensock'
  2. Hmm thats weird, I'm getting the same result. Figured at that point the bytes loaded should be back to 0. Edit: Just had a look see at the LoaderCore.as and around line 250 I justadded in: if (scrubLevel != 2) { _cachedBytesLoaded = 0; //Add this in for a quickfix dispatchEvent(new LoaderEvent(LoaderEvent.UNLOAD, this)); } But might wanna wait for Jack to see if its meant to function like this or not.
  3. Hey ya mate, Think you have to listen for the unload event and then do your trace from there: http://www.greensock.com/as/docs/tween/ ... tml#unload var IMAGE1:ImageLoader = new ImageLoader("images/flower.jpg", {name:"flower", container:this, x:0, y:0, width:200, height:200, onComplete:imageLoaded}); IMAGE1.addEventListener(LoaderEvent.UNLOAD, imageUnloaded); IMAGE1.load(); function imageLoaded(e1:LoaderEvent):void { IMAGE1.unload(); trace(IMAGE1.bytesLoaded); // unload event hasn't completed yet } function imageUnloaded(e1:LoaderEvent):void { trace(IMAGE1.bytesLoaded); // should work now }
  4. Hey ya mate, If I'm understanding you right, you want to clear the old clip before you load in a new one? If thats the case its not really a LoaderMax issue but more the way Flash handles objects in its display list. If you are loading your movies/images etc into an empty movieclip or sprite its faily easy to do: while (holderMovieClip.numChildren > 0) { holderMovieClip.removeChildAt(0); } The will remove any old clips in your holder movieclip, if you stick this just before you load in a new clip in your code, it should remove it before it places the new loaded clip in.
  5. Reckon you could post your files and I could take a quick look see?
  6. I think that has to do with your l, t and p values. You can just use: //event.target.progress //So function updateText(event:LoaderEvent):void { //l = loader.bytesLoaded; //t = loader.bytesTotal; //p = Math.ceil((l/t)*100); loader_mc.loader_txt.text = "Loading: " + String(event.target.progress) + " %"; } to get the progress of the loader instead without all the math and getting of variables if that's what your looking for.
  7. When your loading with LoaderMax you have to use the event it's sending it as your argument in your function. And that event type is a LoaderEvent not a ProgressEvent. Try this for your function instead. function updateText(event:LoaderEvent):void { l = loader.bytesLoaded; t = loader.bytesTotal; p = Math.ceil((l/t)*100); loader_mc.loader_txt.text = "Loading: " + String(p) + " %"; }
  8. Just wrapped up a huge project I've been working on with a mate. A flooring interior designer. 3D was done in 3DSMax and Greensock all the way for the loading and animations. http://www.zyncinteractive.com.au/portfolio/kbdesign/ And another one for a photographer, built with GAIA and Greensock and integrating VIMEO Video http://www.jodymuston.com
  9. Hi Berilac, Yeah typically in site design you want to have all your pages separate as you should think about the end user. They probably don't want to load the entire site in 1 shot, not only would it be slow on some connections but there may only be some specific pages that they want to see. By having a loader for each page you give the user a choice as to weather or not to download that page. You can either make self loaders in each page, or what most people do is build a loader function in the main 'shell' or 'holder' page of your site that loads the separate pages into a movie clip container. GAIA btw is a great framework that guides you with building multipage flash websites both quickly and easily and best of all uses the Greensock library. I don't have any examples at the moment but I'm working on a GAIA + Greensock tutorial series showing how how build a complete site with the GAIA framework + using loaderMax and TweenMax for various elements. Should be out soon.
  10. And you can also use autoAlpha. Will set the visible to false after the tween hits 0 alpha TweenMax.to(mc, 1, { autoAlpha:0 });
  11. Hey ya mate, can you goto Publish setting in your flash movie and turn on debugging under the flash tab. That should tell which line the error is on
  12. Hey ya X10, A technique I use when I want to setup an animation with bezier curves but don't want to keep retyping numbers all the time is to setup a few 'dummy' movieclips on the stage. You can name them p1, p2, p3, p4 etc for however many you need. Then reference the x and y coordinates of each Movieclip as points in your bezier curve. That way you can simply move the movieclips around the stage and it will allow you to dramatically speed up your preview when you are testing your movie without retyping x and y values. Hope that helps.
  13. G'day mate, What error are you getting? And just quickly glancing over your code, with this line: mc_txt.text="loading"+ kbps.ToString()+"%"; The ToString method should be .toString. ie no capital on the T mc_txt.text="loading"+ kbps.toString()+"%"; But yeah if you can post the error your getting it might help find the problem as well. Cheers -Z
  14. Hmm yeah that sounds really weird indeed. A compiled swf should be a compiled SWF with all the AS code embedded although I haven't worked with As2 is a fair while in regards of loading another SWF into a container SWF for ad distribution. I used to make ads for the Eyeblaster network if your familiar with that. Anyways glad you got it working. The code all seems fine.
  15. Hmm not quite sure atm but I can have a look see at it after work today
  16. G'day Soup, I'm pretty sure you can get each loader appended to your loaderMax queue to load into its own container by using the container property. So you can setup multiple loaders all with different containers and still trigger it all with the LoaderMax main loader. var iLoad:ImageLoader = new ImageLoader("myfile.jpg", new ImageLoaderVars() .name("myImage1") .container(myContainer1) )
  17. Tweens can have an onUpdate eventListener attached to them and I reckon this would do what you need it to do with a bit of really simple math. Sorry I don't have Flash in front of me atm but I can write some psuedo code for you. 1. //So Make your tween and add an onUpdate event listener to run to a function 2. //Create a global var called - var oldRotation:Number = 0; 3. //In the onUpdate function create a new variable called var newRotation:Number = yourMC.rotation 4. //Do a test to see if the new rotation is greater than the old - ie your moving clockwise 5. //Do an else to see if the new rotation is less than the old Rotation - ie your moving counter-clockwise 6. //Set the oldRotation var to equal the newRotation var so that when the onUpdate fires the next time round, it will test with the new old Rotation. Hope that makes a bit of sense.
  18. I see the problem, You turned your assets into movieClips inside your shell Movieclip, but you need to give them instance names. And they have to be the same names that you called them in your as2 file, only then will the link between the external ascode and the objects inside the shell work.
  19. You can take a similar external AS approach even with AS2 scripting. A method I use is to create a 'holder' movieclip and set a linkage option of that clip to an external AS2 file. You can then place all your movieclip assets into that holder or 'shell' and work with objects just as you would with AS3 from there. Heres a simple AS2 banner add example if you want a look see:
  20. To add any more objects to orbit, just create another Tweenproxy3D object and then more Tween Max tweens for each element. As for for info. I don't know anything specific but I've linked a few below with an Aladdin's Cave of As3 treasure in them. Also following people on twitter is another great resource: http://www.emanueleferonato.com/ http://blog.theflashblog.com/ http://www.ultrashock.com/ Twitters: http://twitter.com/greensock/ http://twitter.com/leebrimelow http://twitter.com/TH_Flash
  21. G'day mate, Give this a shot. Just be sure to turn your world bitmap into a movieclip with an instance name called world. There's probably a better way to do this but this is just a quick bit of slapped together code. Hopefully gives ya an idea though. Comments below too -Zync package { import com.greensock.TweenMax; import com.greensock.TweenProxy3D; import flash.display.MovieClip; import flash.display.Sprite; import flash.geom.Vector3D; import com.greensock.easing.Linear /** * ... * @author Zync */ public class orbit3d extends Sprite { public var mc:MovieClip; public var world:MovieClip; private var tp:TweenProxy3D; public function orbit3d():void { //Create tweenproxy3d object tp = new TweenProxy3D(mc); //Center our 3D registration to the center of our stage tp.registration = new Vector3D(stage.stageWidth / 2, stage.stageHeight / 2, 0); //Run a looping tweenMax tween that does a check on Update TweenMax.to(tp, 5, { rotationY:360, repeat: -1, ease:Linear.easeNone, onUpdate:checkDepth } ) } //Think function checks the rotation of our mc private function checkDepth():void { //If the rotation if greater than 180, set the clip on top of our world if (mc.rotationY > 180) { stage.addChildAt(mc, 0); } else { //Otherwise set the world on top stage.addChildAt(world, 0) } } } }
  22. Hey ya, Sorry took a while to get back to you, been a little busy. See if this effect works for you. Learned some new stuff in TweenMax which is probably better than a few for loops package { import com.greensock.easing.Cubic; import com.greensock.easing.Sine; import com.greensock.events.LoaderEvent; import com.greensock.TimelineMax; import com.greensock.TweenMax; import flash.display.MovieClip; import com.greensock.TimelineMax; import com.greensock.events.TweenEvent /** * ... * @author Zync */ public class main extends MovieClip { private var aItems:Array; public function main() { aItems = new Array(b1, b2, b3, b4, b5, b6); TweenMax.allTo(aItems, 1, { y:"200", ease:Cubic.easeOut }, 0.2, function() { TweenMax.allTo(aItems, 1, { x:"-800", ease:Sine.easeOut }, 0.1); }); } } Or if you want to manually edit the delay's aItems = new Array(b1, b2, b3, b4, b5, b6); TweenMax.allTo(aItems, 1, { y:"200", ease:Cubic.easeOut }, 0.2, function() { for (var i:int = 0; i < aItems.length; i++) { var item:MovieClip = aItems[i]; TweenMax.to(item, 0.5, { x:"-800", ease:Sine.easeOut, delay:(i * 0.2) } ); } }); And cheers Carl, love your videos on your site as well!
  23. If you could zip and post your fla and as file I can have a quick look see over it.
  24. This effect is not really a Tween related problem specifically, more Math related. Sound like you want the billboard (thats what I'm gonna your mc2) to move a proportional amount based on where the mouse is relative to the stage height and width. Kind of like an inverse parallax effect with only 1 layer. So lets use some arbitary numbers. Lets assume that your billboard has its registration point in the uppleft corner, is on the stage posited at the upper left and is 1000x1000 And lets assume your stage size is: 500x500 And lets work with the X axis to begin with. If your mouse is all the way to the left of the stage, so 0 on the x axis, then your billboard clip's .x should be set to 0. If your mouse is all the way to the right of the stage, so stage.stageWidth then your billboard clip's .x should be -500. Now we need to find a ratio formula to solve this. I'd probably go with: var xRatio:Number = ((stage.stageWidth - mc2.width) / stage.stageWidth); var xTweenAmount:Number = stage.mouseX * xRatio; The y axis will be similar. stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove); function mouseMove(e:MouseEvent):void { var xRatio:Number = ((stage.stageWidth - mcBox.width) / stage.stageWidth); var xTweenAmount:Number = mouseX * xRatio; var yRatio:Number = ((stage.stageHeight - mcBox.height) / stage.stageHeight); var yTweenAmount:Number = mouseY * yRatio; mcBox.x = xTweenAmount; mcBox.y = yTweenAmount; }