Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

wind_kind's Achievements


Newbie (1/14)



  1. I've tried a couple of things now but I need help with this please. I have a draggable block that I want to restrict from going past the top of the screen but should be able to drag past the bottom fully. If you view the pen I did, you will see an arrow/tab at the bottom. Ideally this tab will be halfway visible at the bottom and when the block is dragged all the way up the bottom half should be visible plus 5px of the grey background. So when dragging the red block to the top it should stop 5px before so I don't see the grey peeking out at the bottom. So far I can drag it all the way and then I did some checks to just get the red block in place but I have to get those bounds right. Like I said, I tried using hitTest and some of my own logic and checking the element Y position etc but my knowledge with this is limited.
  2. ah brilliant. It works great and I learned about the yPercent. This is such a great tool. Thanks.
  3. Thanks for the reply OSUblake. Your example is close to what I am looking to do and playing around with the min max gets me close but I don't want to be able to drag toward the bottom at all and when dragging up the bottom of the nav should never move past the bottom of the screen. No matter how I change it, I can always drag the nav up a lot.
  4. I have the basics figured out from following the brilliant docs, thanks for that. I am stuck however. I would like the nav in my example to be draggable only to the top and only by about 45 pixels. When it reaches 45px you shouldn't be able to drag it any further and then on release obviously it tweens back to where it started (but that I have working already). It would be cool if I can have the edgeResistance kick in as well close to the end of the drag but it's not required. It should be easy but I can't get my head around how I will achieve this.
  5. Hi I have another couple of question about scaling. I have the box I'm scaling in a content sprite that scales itself as the movie dimensions change along with the browser window size. Question 1. How do I scale the box to the stage width and when stage resizes the box resize with it, I thought it should do that anyway because it is inside a container that resizes the rest of the content but it just sticks to its set width. Question2. This doesn't really have to do with tweenmax but hopefully someone can help anyway. I have an if statement that checks to see if any instance of one of the boxes are already loaded on the stage and if so tween it of stage and remove the child from the parent it was attached to. So obviously the statement doesn't work (I know how if statements work, sort of but I don't really know how what commands to use to get the desired result) Just trying my luck her if somone can help. If not the first question would be great if someone could help. Thanx in advance package { import flash.display.SpreadMethod; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.ContextMenuEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.filters.BlurFilter; import flash.filters.GlowFilter; import flash.net.URLLoader; import flash.ui.Mouse; import gs.TweenMax; public class main extends Sprite { //public static var origW:Number = 1024 //original stage width //public static var origH:Number = 768 //original stage height //public static var //graphic resources private var bg:Sprite = new Sprite; private var cont:Sprite = new Sprite; private var art:Sprite = new Sprite; private var photo:Sprite = new Sprite; private var project:Sprite = new Sprite; var box:Sprite = new Sprite; var box1:Sprite = new Sprite; var box2:Sprite = new Sprite; //get the new stage height var sw:Number = stage.stageWidth; var sh:Number = stage.stageHeight; //constructor public function main () { //Tel the player not to scale the assets stage.scaleMode = StageScaleMode.NO_SCALE; //Tell the player to put co-ords 0,0 to the top left corner stage.align = StageAlign.TOP_LEFT; //Listen for resize events stage.addEventListener(Event.RESIZE, onResize); //Create and add body resource to the display list bg = new bg_mc(); addChild(bg); cont = new content(); addChild(cont); art = new art_mc(); cont.addChild(art); art.x = 94.2; art.y = 512.5; photo = new photo_mc(); cont.addChild(photo); photo.x = 136.1; photo.y = 517.9; project = new project_mc(); cont.addChild(project); project.x = 150; project.y = 535; //Size everything after creation to insure the app is drawn //properly the first time it is seen prior to any user initiated //resizing onResize(null); art.addEventListener(MouseEvent.CLICK, ClickListener) photo.addEventListener(MouseEvent.CLICK, ClickListener1) project.addEventListener(MouseEvent.CLICK, ClickListener2) //set button properties art.buttonMode = true; art.useHandCursor = true; photo.buttonMode = true; photo.useHandCursor = true; project.buttonMode = true; project.useHandCursor = true; //check ClickListener function ClickListener(event:MouseEvent):void { art.mouseEnabled = false; photo.mouseEnabled = true; project.mouseEnabled = true; trace("button clicked:" + event.currentTarget); if (Boolean(cont.getChildByName('box1'))) { TweenMax.to(box1, 0.2, { x:500 } ); cont.removeChild(box); } if (Boolean(cont.getChildByName('box2'))){ TweenMax.to(box2, 0.2, { x:500 } ); cont.removeChild(box); } box.graphics.lineStyle(2, 0xffffff, 0.5, false, "none"); box.graphics.beginFill(0x000000, 0.5); box.graphics.drawRect(0, 0, 10, 10); box.graphics.endFill(); cont.addChild(box); TweenMax.multiSequence ([ { target:box, time:0.2, y:625 }, { target:box, time:0.5, scaleY:12 }, { target:box, time:1, x:35, scaleX:95 } ]); } function ClickListener1(event:MouseEvent):void { art.mouseEnabled = true; photo.mouseEnabled = false; project.mouseEnabled = true; trace("button clicked:" + event.currentTarget); if (Boolean(cont.getChildByName('box'))) { TweenMax.to(box, 0.2, { x:500 } ); cont.removeChild(box); } else{ if (Boolean(cont.getChildByName('box2'))){ TweenMax.to(box2, 0.2, { x:500 } ); cont.removeChild(box2); } } box1.graphics.lineStyle(2, 0xffffff, 0.5, false, "none"); box1.graphics.beginFill(0x000000, 0.5); box1.graphics.drawRect(0, 0, 10, 10); box1.graphics.endFill(); cont.addChild(box1); TweenMax.multiSequence ([ { target:box1, time:0.2, y:625 }, { target:box1, time:0.5, scaleY:12 }, { target:box1, time:1, x:35, scaleX:95 } ]); } function ClickListener2(event:MouseEvent):void { art.mouseEnabled = true; photo.mouseEnabled = true; project.mouseEnabled = false; trace("button clicked:" + event.currentTarget); if (Boolean(cont.getChildByName('box'))) { TweenMax.to(box, 0.2, { x:500 } ); cont.removeChild(box); } else{ if (Boolean(cont.getChildByName('box1'))){ TweenMax.to(box1, 0.2, { x:500 } ); cont.removeChild(box1); } } box2.graphics.lineStyle(2, 0xffffff, 0.5, false, "none"); box2.graphics.beginFill(0x000000, 0.5); box2.graphics.drawRect(0, 0, 10, 10); box2.graphics.endFill(); cont.addChild(box2); TweenMax.multiSequence ([ { target:box2, time:0.2, y:625 }, { target:box2, time:0.5, scaleY:12 }, { target:box2, time:1, x:35, scaleX:95 } ]); } } //listening for stage resize public function onResize(event:Event):void { sh = stage.stageHeight; sw = stage.stageWidth; //then update the children with this new size bg.height = sh; bg.width = sw; cont.height = sh; cont.width = sw; } } }
  6. sorry but I have another one for you. When I draw the box and I use this: box.graphics.lineStyle(1); to get a border, then when I scale the box the border or line scales in width and height as well. Is there a different way of doing it? function ClickListener(event:MouseEvent):void { trace("button clicked:" + event.currentTarget); var box:Sprite = new Sprite(); art.useHandCursor = true; box.graphics.beginFill(0x000000, 0.8); box.graphics.drawRect(0, 0, 10, 10); box.graphics.endFill(); cont.addChild(box); TweenMax.multiSequence ([ { target:box, time:0.2, y:625 }, { target:box, time:0.5, scaleY:12 }, { target:box, time:1, x:35, scaleX:95 } ]); } I'm going to bed now so I won't bother anybody after this one. thanx
  7. awesome!! Thanx a mill. Great job with TweenMax, it's so easy to understand once you get use to it and a little help into the right direction, (I'm very new to all this, as you can probably tell by now). thanx again
  8. that seems to work but I have another question. Can I do the tweens sequentially and how is this done?
  9. Hi Can anybody please tell me what I am doing wrong cause I'm missing something really easy and stupid here. my sprite doesn't scale like I want it, instead it just tweens to some position off of the stage. I want to do this if it is possible at all.(uploaded swf) this is my code art.addEventListener(MouseEvent.CLICK, ClickListener) photo.addEventListener(MouseEvent.CLICK, ClickListener) project.addEventListener(MouseEvent.CLICK, ClickListener) function ClickListener(event:MouseEvent):void { trace("art button clicked") var box:Sprite = new Sprite(); box.graphics.beginFill(0xffffff, 1); box.graphics.drawRect(10, 600, 10, 10); box.graphics.endFill(); cont.addChild(box); TweenMax.to(box, 1, {scaleY:3}); } Thanx for any help