Jump to content
GreenSock

eldreams

Members
  • Posts

    5
  • Joined

  • Last visited

Reputation

1 Newbie
  1. I have a external loader that loads my main SWF. Within the external loader code I have: Code: var ls:LiquidStage = new LiquidStage(this.stage, 750, 550, 750, 150); var area:LiquidArea = new LiquidArea(this, 0, 0, 750, 550, 0x151515); area.pinCorners(ls.TOP_LEFT, ls.BOTTOM_RIGHT, false, 1); ls.attach(mc_randomtext, ls.CENTER, false, true, 1); mc_randomtext is my loader animation... When the complete handler is triggered and the main SWF is loaded/transitioned in I'm having problems with the pictures in the main SWF. Within the main SWF I also use LiquidStage: Code: var ls:LiquidStage = new LiquidStage(this.stage, 750, 550, 750, 150); var area:LiquidArea = new LiquidArea(this, 0, 0, 750, 550, 0x151515); area.pinCorners(ls.TOP_LEFT, ls.BOTTOM_RIGHT, false, 1); area.attach(picx); //<-This picture isn't showing right (Not proportional inside). I think the problem is "this" as I think it's referencing the external loader (swf). When I fire off the main SWF without using the external loader the swf previews fine. Can someone please help? I have disabled the preloader/external loader because I can't get it to display right/act right.
  2. I think I figured it out using the liquid stage. Thankyou.
  3. My re-size event listener that goes after the code I supplied earlier. stage.addEventListener(Event.RESIZE, sizeListener); function sizeListener(e:Event):void { //pic.x=stage.stageWidth / 2; //pic.y=stage.stageHeight / 2; pic.x = 0; pic.y = 0; pic.width=stage.stageWidth; pic.height=stage.stageHeight; }
  4. I found the following code, however I cannot get my stage resize/event handler to work. Basically I want the pictures to keep proportion/transition even when the browser is resized. I tried removing the props from the image loader and applying directly to the resize/event handler, but it just skew's streches the image out of proportion -and once it transitions to the new picture the proportions do not change. Any ideas? import com.greensock.*; import com.greensock.easing.*; import com.greensock.events.*; import com.greensock.loading.*; import com.greensock.loading.display.*; import flash.display.DisplayObject; import flash.text.TextField; import flash.utils.Timer; LoaderMax.activate([imageLoader]); var addresses:Array = ["img00.jpg", "img01.jpg", "img02.jpg", "img03.jpg", "img04.jpg"]; var images:Array = new Array(); var pic:Sprite = new Sprite(); addChild(pic); var progressText:TextField = new TextField(); progressText.text = "0"; progressText.autoSize = TextFieldAutoSize.CENTER; progressText.y = stage.stageHeight / 2 - progressText.height/2; addChild(progressText); var picTimer:Timer; var timerRunning:Boolean; var counter:int = 0; var timerDelay:Number = 2000; var tweenDuration:Number = 1; var loader:LoaderMax = LoaderMax.parse(addresses, { name:"galleryLoader", maxConnections:1, onComplete:allComplete, onChildProgress:imageProgress, onChildComplete:imageLoaded}, { alpha:0, centerRegistration:true, x:stage.stageWidth / 2, y:stage.stageHeight / 2, width:stage.stageWidth, height:stage.stageHeight, scaleMode:"proportionalOutside"}) as LoaderMax; loader.prependURLs("images/", false); loader.load(); function imageProgress(e:LoaderEvent):void { var percent:int = e.target.progress * 100; progressText.x = stage.stageWidth / 2 - progressText.width/2; progressText.text = e.target.url + " " + percent + "%"; } function imageLoaded(e:LoaderEvent):void { var img:ContentDisplay = e.target.content as ContentDisplay; progressText.text = "0"; images.push(img); } function allComplete(e:LoaderEvent):void { removeChild(progressText); var p:ContentDisplay = images[counter] as ContentDisplay; pic.addChild(p); TweenMax.to(p, 1, {alpha:1}); picTimer = new Timer(timerDelay); picTimer.addEventListener(TimerEvent.TIMER, newPic); picTimer.start(); timerRunning = true; counter++; stage.addEventListener(MouseEvent.CLICK, startStop); } // load new bitmap from the array; increment counter function newPic(e:TimerEvent):void { var _p:ContentDisplay = pic.getChildAt(0) as ContentDisplay; TweenMax.to(_p, tweenDuration, {alpha:0, onComplete:pic.removeChild, onCompleteParams:[_p]}); var p:ContentDisplay = images[counter] as ContentDisplay; trace(p); pic.addChild(p); TweenMax.to(p, tweenDuration, {alpha:1}); if (counter < images.length - 1) { counter++; } else { counter = 0; } } function startStop(e:MouseEvent):void { if (timerRunning) { picTimer.stop(); } else { picTimer.start(); } // toggle timerRunning; timerRunning = ! timerRunning; trace("timerRunning: " + timerRunning); }
  5. I'm new to adobe flash, and I'm trying to find some action script (AS3) that will give me the scrolling effect that is here http://www.exclusivestyle.pl/ Essentially what I want is to be able to hover and scroll up/down just my moving the mouse up/down. I would be very thankful if someone could provide me the code or even link to another post/tutorial. Thank you very much!
×