Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Image Pan - Want To Center/scale Relative To Position At Click



Hi - I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:http://www.kirupa.com/developer/flas..._image_pan.htmIf anyone knows of a tutorial or example out there, I'd love directions to it(them). or, if you're an empathetic AS god out there, I'd love some help understanding the conceptuals. I'm new to function writing in AS, and am struggling. Thanks so much...



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 08-19-2006, 08:26 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Image Pan - Shift/scale Relative To Position At Click
Hi - I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:

http://www.kirupa.com/developer/flas..._image_pan.htm

If anyone knows of a tutorial or example out there, I'd love directions to it(them). or, if you're an empathetic AS god out there, I'd love some help understanding the conceptuals. I'm new to function writing in AS, and am struggling. Thanks so much...

Why The Image Doesn't Center On First Click?
Can someone tell me why the image does not center up after the first click, but does center up on subsequent clicks?

After the first click I get this.

http://picasaweb.google.com/fannon99...23552249976274

After the second click I get this.

http://picasaweb.google.com/fannon99...23553466160898

Here is the code.


Code:
import fl.containers.UILoader;
import caurina.transitions.*;

//---------loading the external xml file-------
var urlRequest:URLRequest = new URLRequest("pics.xml");
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
urlLoader.load(urlRequest);

//--------holds the paths to the thumbnails-------
var arrayURL:Array = new Array();

//--------holds the paths to the big photos-------
var arrayName:Array = new Array();

//--------holds the thumbnail objects-------
var holderArray:Array = new Array();

//--------represents the number of collumns-------
var nrColumns:uint = 5;

//-------represents the container of our gallery
var sprite:Sprite = new Sprite();
addChild(sprite);
var thumb:Thumbnail;

//-------- the thumbnails container-------
var thumbsHolder:Sprite = new Sprite();
sprite.addChild(thumbsHolder);

//-------- the photoLoader container-------
var loaderHolder:Sprite = new Sprite();
loaderHolder.graphics.beginFill(0xffffff,1);
loaderHolder.graphics.drawRect(0,0,800,600);
loaderHolder.graphics.endFill();
loaderHolder.x = 1000;
loaderHolder.y = 0;
var loaderXPos = (stage.stageWidth/2) - loaderHolder.width/2;
var loaderYPos = (stage.stageHeight/2) - loaderHolder.height/2;
sprite.addChild(loaderHolder);

//-------- loads the big photo-------
var photoLoader:UILoader = new UILoader();
photoLoader.addEventListener(MouseEvent.CLICK, onClickBack);
photoLoader.maintainAspectRatio = true;
photoLoader.scaleContent = false;
//photoLoader.width = 800;
//photoLoader.height = 600;
//photoLoader.y = 5;
//photoLoader.x = 5;
photoLoader.buttonMode = true;
loaderHolder.addChild(photoLoader);
function centerPosition(e:Event) {
e.target.x = (stage.stageWidth/2) - e.target.width/2;
e.target.y = (stage.stageHeight/2) - e.target.height/2;
}
photoLoader.addEventListener(Event.COMPLETE, centerPosition);


/* we loop through the xml file
populate the arrayURL, arrayName and position the thumbnalis*/
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i:int=0; i<xmlList.length(); i++) {
var picURL:String = xmlList[i].url;
var picName:String = xmlList[i].big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray[i] = new Thumbnail(arrayURL[i],i,arrayName[i]);
holderArray[i].addEventListener(MouseEvent.CLICK,onClick);
holderArray[i].name = arrayName[i];
holderArray[i].buttonMode = true;
if (i<nrColumns) {
holderArray[i].y = 65;
holderArray[i].x = i*110+65;
} else {
holderArray[i].y = holderArray[i-nrColumns].y+110;
holderArray[i].x = holderArray[i-nrColumns].x;
}
thumbsHolder.addChild(holderArray[i]);
}
}

//----handles the Click event added to the thumbnails--
function onClick(event:MouseEvent):void {
photoLoader.source = event.currentTarget.name;
Tweener.addTween(thumbsHolder, {x:-650, time:1, transition:"easeInStrong"});
Tweener.addTween(loaderHolder, {x:loaderXPos, y:loaderYPos, time:1, transition:"easeInStrong"});
Tweener.addTween(thumbsHolder, {alpha:0, time:1, transition:"linear"});
Tweener.addTween(loaderHolder, {alpha:1, time:1, transition:"linear"});
}

//----handles the Click event added to the photoLoader----
function onClickBack(event:MouseEvent):void {
Tweener.addTween(thumbsHolder, {x:0, time:1, transition:"easeInStrong"});
Tweener.addTween(loaderHolder, {x:1000, time:1, transition:"easeInStrong"});
Tweener.addTween(thumbsHolder, {alpha:1, time:2, transition:"linear"});
Tweener.addTween(loaderHolder, {alpha:0, time:2, transition:"linear"});
}
Here is the .fla

Thanks

MC Image Zoom On Mouse Click & Position.
Howdy all again,

I have a picture of a product within an MC that I'd like to zoom in and out behind a mask with a click and is restrained within the size of the MC.

Something like this that I found on this forum.

http://www.flashkit.com/movies/Inter...8487/index.php

I have no idea what I am doing..ha and for some reason it doesnt want to work when I replicate it in a new flash pro 8 doc.

What id like is to have that example work as or inside an MC and only when the mouse is over it. Am I asking for too much?..ha
If someone could figure it out for me there will be a "virtual" slab of beer in it for them. Pointing me in the right direction might help just bear in mind my website is built around the cut & paste method..lol

Cheers.

How Do I Scale From Center Of Stage, Not Center Of MC?
I'm building a Flash map that I'd like to be able to scale in and out of. I've added a + and - button and linked them to a 5% + or - of the main MC's x and y scale. But, on press I'd like it to scale from the center of the stage, not the center of the movie clip, so that when I zoom further into LA the whole image doesn't go shooting off to the left, since LA is on the far left of my enlarging MC. How do I do this? Am I on the right track here?:
//onPress increase x and y scale 5%. no prob.
//move the map by combining an understanding of the center point of the MC, the centerpoint of the Stage (half the width, maybe), and then maybe multiplying it by some factor of my current %scale, since a 5% increase is a varying number, depending on my current scale.

Seems like this would work, but I'm not sure what that math would be.
...or is there a better way like a built in method that deals with MC centerpoints?

Thanks,
Greg

X-scale And Relative X And Y Values?
Please help!!

This is driving me crazy!! I have a main movie clip which is a background, this needs to be scaled to fit onto an A4 page for printing, this i can do with the xscale, however i also have dragable movie clips which go on top of the background, when i xscale these they go smaller, however their x and y values remain the same, as they did before xscaleing anything, so they are outside of the boundary of the main background.

Basically all i need to know is there anyway of changing the dragable _mc's x and y values relative to the main_mc's xscale value??

Please help it is much appreciated

Thanks

Background Relative Scale
I am somewhat new to AS, and am trying to figure something out.
I am working on a website which when loads has a background image. I want this image to scale relative to browser window without image distortion while the main contents stays in center.

Thus far I have a main.fla file, a main.as file which controls the scale of the stage, and a background.as which loads the image and sets its resize properties.

Also, can anyone explain why when the i test this, the window pops up blank, and the image doesnt show up until i drag the window to resize.

main.as
[code]package classes {

import flash.display.Sprite;
import flash.display.Stage;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.events.Event;
import content.*

public class main extends Sprite {

private var swfLoader:Background;

public function main() {
init();
}

private function init():void {
initStage();
addBackground();
onStageResize();
}

private function initStage():void {
stage.frameRate = 30;
stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, onStageResize);
}

private function onStageResize(... eventArray:Array):void {
swfLoader.resize(stage.stageWidth, stage.stageHeight);
}

private function addBackground():void {
swfLoader = new Background();
addChild(swfLoader);
}
}
}

/code]
Background.as
[code]package content {

import flash.net.URLLoader;
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;

public class Background extends Sprite {

private var swfLoader:Loader;

public function Background():void {
swfLoader = new Loader();
swfLoader.load(new URLRequest("content/images/Background.jpg"));
addChild(swfLoader);
}

public function resize(w:Number, h:Number):void {
this.width = w;
this.height = h;
}
}
}
/code]

I understand this is probably a super noob question, but any help would be greatly appreciated.

Thank You!

Quick Question About Relative Scale..
So I have a vector drawing on my stage...and it's 1000px wide.
Say I resize that with vector_mc._width = 500px (which is visually the same as changing the x scale to 50).
Is there a way to set the new width (500) as the absolute width..meaning if you asked the vector to scale to 100 it would go to 500px and not the original 1000px?
It's a basic question but it's something I never learned without any formal teaching.
Thanks

Full Flash Sites / How To Relative Scale?
Do you know how they do that? Check this site:
http://www.ramazani.com/

The site is fully Flash, no html page, ok that was the easy part, just put the link to the swf.

But @ the site the pictures scale to the browser size, but the text doesn't. How they do that? I tried fscommand but didn't work.

Thx in advance.

Scale Down From Center
I've been trying to get buttons to decrease in size and opacity (from their center) by a factor of 1, using on(release), until the button is 100% transparent and too small to view.

I've tried various methods, but either the button won't scale, or each time it does, it nudges to the top-left of the movie.

Any help would be much appreciated.

::bluemoth::

Scale And Keep CENTER
Hi all

How can I Keep center off my movie when I drag I around


Ive got a slider that scale my map

onClipEvent (enterFrame) {
_root.Map._xscale = (200/50 )* (_root.dragger._x );
_root.Map._yscale = (200/50 )* (_root.dragger._x );
}

My map can be drag around to place of interest.. But when scalling
again it keep its old centerpoint

I guees that I need some code to set the new center point after
it has been dragged around.

Hope for good Ideas

AS3 - Scale From Center?
Each time the square is clicked it scales up a little. What must be added or changed to prevent it from moving off center from its original position, and to have it scale evenly in all directions from its own center?


Code:
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.*;

public class NewTest extends Sprite{

private var s:Shape;
private var sHolder:Sprite;

public function NewTest(){
sHolder = new Sprite();
addChild(sHolder);
s = new Shape();
s.graphics.beginFill(0xFFFFFF);
s.graphics.drawRect(20,20,10,10);
s.graphics.endFill();
sHolder.addChild(s);
sHolder.addEventListener(MouseEvent.CLICK, start);
}

public function start(e:MouseEvent):void{
s.scaleX+=1;
s.scaleY +=1;
}
}
}
Fingers

Map-Scale/Center Problem
Hi all,
I'm in big trouble and I can't understand the thing going on when you scale a movie sequenz. System is Flash 5, I'm working on a citymap for a cd, so please hang on long loading terms concerning the link, it's near to 5 mb size - sorry for that.


http://home.pages.at/genx/flashtest/Stadtplan.html

If you open the page you see a zoom-tool at the bottom, a plus and a minus button, if you press them the map starts to zoom in and out but it also starts to move, in fact its not moving, but the scale is changed and it looks like the map moving out of the film. How can I correct this???? How can I make it look like zooming really to the center of the window (for orientation I drawed a cross over the map!).
I tried different corrections by giving the map new _x,_Y coordinates with the zoom-buttons, but depending on where on the map you are the correction-distance is different to each other.

This is the plus-button script:

on (release) {
if (slidenr == 1) {
setProperty ("GI-Karte", _xscale, 500);
setProperty ("GI-Karte", _yscale, 500);
slidenr=2;
} else if (slidenr==2) {
setProperty ("GI-Karte", _xscale, 600);
setProperty ("GI-Karte", _yscale, 600);
slidenr=3;
} else if (slidenr==3) {
setProperty ("GI-Karte", _xscale, 700);
setProperty ("GI-Karte", _yscale, 700);
slidenr=4;
} else if (slidenr==4) {
setProperty ("GI-Karte", _xscale, 800);
setProperty ("GI-Karte", _yscale, 800);
slidenr=5;
} else if (slidenr==5) {
setProperty ("GI-Karte", _xscale, 900);
setProperty ("GI-Karte", _yscale, 900);
slidenr=6;
} else if (slidenr==6) {
setProperty ("GI-Karte", _xscale, 1000);
setProperty ("GI-Karte", _yscale, 1000);
slidenr=7;
} else if (slidenr==7) {
setProperty ("GI-Karte", _xscale, 1100);
setProperty ("GI-Karte", _yscale, 1100);
slidenr=8;
} else if (slidenr==8) {
setProperty ("GI-Karte", _xscale, 1200);
setProperty ("GI-Karte", _yscale, 1200);
slidenr=9;
} else if (slidenr==9) {
setProperty ("GI-Karte", _xscale, 1300);
setProperty ("GI-Karte", _yscale, 1300);
slidenr=10;
} else if (slidenr==10) {
setProperty ("GI-Karte", _xscale, 1400);
setProperty ("GI-Karte", _yscale, 1400);
slidenr=11;
} else if (slidenr==11) {
setProperty ("GI-Karte", _xscale, 1400);
setProperty ("GI-Karte", _yscale, 1400);
slidenr=11;
}
}

At the top in blue are the actuell coordinates of the map-sequenz, you can move the map by pressing at the blue tool left of the zoom-buttons, or with the green buttons (half-distance change!).

If there are any ideas, any help would be welcome...


If it's possible, as fast as you can, because I'm a bit in time trouble for finishing the hole map.


http://home.pages.at/genx/flashtest/Stadtplan.html

Auto Center And Scale?
Hi ya

Can anyone tell me the scirpt command so that:

1. the swf file (embedded in html) will auto matically center itself in the borwser

and

2. Scale itself down depending on what resolution the client is using (is that even possible)?

Thanks

Hong

Actonscript Scale From Center
Hi I have a very simple page with twelve invisible buttons, I have applied actionscript to grow/shrink the movieclips below on rollover / rollout.. only problem is they are growing from the top left edge.. not the center of the MC.. how can I make the MC grow / shrink from the center??

Thanks
Martin

Loading MCs Position Relative To Last.
I have a series of buttons with the instance names; button1, button2, button3, etc. and I would like, when I click on each one to load MC's I've created (clip1, clip2, clip3, etc). button1 should load clip1, etc. I would like the first clip loaded to be positioned at x=100, y=100. Then each one after that should be positioned 25 pixels down and to the right. I get the feeling this isn't too hard, but I don't even know where to begin. I am working in Flash MX.

Mc Size Relative To It's Own Position?
Hello all,
I have posted the same post in the newbie forum,
but received no reply, so I am posting it here to.
I hope I will not get into trouble because of this : )

I want to crate a simple thing, I hope.
I searched on the net and I was not able to find a solution.

I have a movieclip of a character that is built out of many other mc
inside of him, like parent and children's and so on.

You can drag the whole man with the torso part, which is a button some
where inside the man mc.

But I need it to resize the man as you drag him up and down
on the y axis, as if he is getting far and close.

I use flash 8 and actionscrpit2 with the script assist turned on.

Please help me I am lost,
Thanks.

Position MC Relative To Stage Using AS
Hey guys,

Another simple one... I'm trying to change position of a MC, using actionscript. Simple enough... catch is... I want the position relative to the Stage, not the parent.


ActionScript Code:
contact_mc._x = 10;

That will put the mc, in x position 10 but relative to the parent.

I need it to be at 10, on the Stage itself, is there a simple method? Something like...

ActionScript Code:
contact_mc._x = _root.10;

Hope this makes sense to someone, as I'm in desparate need

Position A Clip Relative To Another MC.
Hey guys, long time lurker here.
Need some help.

How can I position 2 movie clips on both sides of another movie clip.
This is hard to explain BUT.

I have a Movie that has Dynamic text placed right in the middle and on each side of the Dynamic Text is static text (each in its own MC)

How can I make the text on the left move to the edge of the Dynamic text, and the text on the right snap to the right side of the Dynamic text.

The dynamic text s a number, that will change to a 3 digit number from time to time, and I want to be sure the text on both sides are right next to the center MC.


Thanks
Scott

AttachMovie - Position Relative To Where?
Hi,

I'm using XML to import products into my swf...

I employ the attachMovie() function to achieve this, but there's a problem.
I can't seem to control where they go, I set their positions relative to a movieclip (theFrame) but they always appear to the right and a bit to the top.

Has anybody got any advice?

Thanks,
Tim.









Attach Code

ThisItem = "Girl" + i;

MC = attachMovie("XmlItem", ThisItem, i, frame);

MC._x = LastX;
MC._y = LastY;

Go To A Position RELATIVE To The Current
Hallo,

For the Homepage of my School I have to make a Page-Overview. I use many
(this time 20) different, but same sized, images. These should stay 10 sec.
and then should come the next one. If you click (on.Press) at the image,
the page should be opend. How you can see at http://www.dreieichschule.de/
I was able to do so. But know I have a problem: I have to put the arrow to
skip through the images on every layer. So I have to write many codes and I
have to put the in the correct position. And here is my question: Is it
possible to make one layer on which you can find the arrows with *one* code
to skip (for each arrow) through the timeline. I would like to go to the
next ore the previous keyframe. But at the moment, every Image is in an own
layer. Do I have to change this? I hope you can help me and I hope you
understood what I tried to say. If not, write a message to me

Kai

--
.-. .-. --..::==
( )( ) //"
'-' '-' /

How To Put LoadMovie In Relative Position?
Hi everyone!

Well I'm upgrading the carousel to load movies into the stage.
I'm joining the fullscreen flash tecnology too cause I need the flash to be good in all resolutions.

I got sucess in carousel, and in the stage elements. But when i load a movie (swf) into the stage, I dont have control of their position. I need to put it in a relative position like everything in the stage but i dont know how.

help please...

I will put all code here for the ones who needs to know more to help me.
Thx everyone!

Code:

import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;

var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width/2;
var centerY:Number = (Stage.height/2)-15;
var speed:Number = 0.05; // usar numeros baixos
var perspective:Number = 0;
var home:MovieClip = this;

var alvo:MovieClip = new MovieClip();
alvo._x = centerX;
alvo._y = centerY;

theText._alpha = 0;
clique._alpha = 0;
var s_click:Sound = new Sound();
s_click.loadSound('sounds/click.mp3',false);
var s_enter:Sound = new Sound();
s_enter.loadSound('sounds/enter.mp3',false);
var s_back:Sound = new Sound();
s_back.loadSound('sounds/back.mp3',false);


var tooltip:MovieClip = this.attachMovie("tooltip", "tooltip", 10000);
tooltip._alpha = 0;

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function(){
   var nodes = this.firstChild.childNodes;
   numOfItems = nodes.length;
   for (var i=0;i<numOfItems;i++)
   {
      var t = home.attachMovie("item","item"+i,i+1);
      t.angle = i * ((Math.PI*2)/numOfItems); //Math.PI*2 = 360º
      t.onEnterFrame = mover;
      t.toolText = nodes[i].attributes.tooltip;
      t.content = nodes[i].attributes.content;
      t.icon.inner.loadMovie(nodes[i].attributes.image);
      t.r.inner.loadMovie(nodes[i].attributes.image);
      t.icon.onRollOver = over;
      t.icon.onRollOut = out;
      t.icon.onRelease = released;
   }
}

var iconScale:Number = 60;
function over()
{
   s_click.start();
   if (this._xscale > iconScale) {
        home.tooltip.tipText.text = this._parent.toolText;
        home.tooltip._x = this._parent._x;
        home.tooltip._y = this._parent._y - this._parent._height/2;
        home.tooltip.onEnterFrame = Delegate.create(this,moveTip);   
        home.tooltip._alpha = 100;
      }
}

function out(){
   delete home.tooltip.onEnterFrame;
   home.tooltip._alpha = 0;
}

function released(){
   home.tooltip._alpha = 0;
   s_enter.start();
   for (var i=0;i<numOfItems;i++){
      var t:MovieClip = home["item"+i];
      t.xPos = t._x;
      t.yPos = t._y;
      t.theScale = t._xscale;
      
      delete t.icon.onRollOver;
      delete t.icon.onRollOut;
      delete t.icon.onRelease;
      delete t.onEnterFrame;
      // esconder os icones nao clicados
      if (t != this._parent){
         var tw:Tween = new Tween(t,"_xscale", Strong.easeOut, t._xscale,0,1,true);
         var tw2:Tween = new Tween(t,"_yscale", Strong.easeOut, t._yscale,0,1,true);
         var tw3:Tween = new Tween(t,"_alpha", Strong.easeOut, 100,0,1,true);
      }
      else{
         var tw:Tween = new Tween(t,"_xscale", Strong.easeOut, t._xscale,100,1,true);
         var tw2:Tween = new Tween(t,"_yscale", Strong.easeOut, t._yscale,100,1,true);
         var tw3:Tween = new Tween(t,"_x", Strong.easeOut, t._x,centerX-200,1,true);
         var tw4:Tween = new Tween(t,"_y", Strong.easeOut, t._y,centerY+50,1,true);
         var tw5:Tween = new Tween(clique,"_alpha", Strong.easeOut, 0,100,1,true);
         /*if ((i!=1)&&(i!=6)&&(i!=3)&&(i!=5)){
            var tw6:Tween = new Tween(theText,"_alpha", Strong.easeOut, 0,100,1,true);
            theText.text = t.content;
         }*/
         
         if (i==0){
            loadMovieNum('faq.swf',2);//loadmovie
         }
         if (i==1){
            loadMovieNum('formreq.swf',2);//loadmovie
         }
         if (i==2){
            loadMovieNum('empresa.swf',2);//loadmovie
         }
         if (i==3){
            loadMovieNum('servicos.swf',2);//loadmovie
         }
         if (i==4){
            loadMovieNum('downloads.swf',2);//loadmovie
         }
         if (i==5){
            loadMovieNum('parceiros.swf',2);//loadmovie
         }
         if (i==6){
            loadMovieNum('formcont.swf',2);//loadmovie
         }
         if (i==7){
            loadMovieNum('eventos.swf',2);//loadmovie
         }
         
         var s:Object = this;
         tw.onMotionStopped = function() {
            s.onRelease = unRealeased;
         }
      }
   }
}

function unRealeased(){
   s_back.start();;
   delete this.onRelease;
   var tw:Tween = new Tween(theText,"_alpha", Strong.easeOut, 100,0,0.5,true);
   var tw2:Tween = new Tween(clique,"_alpha", Strong.easeOut, 100,0,0.5,true);
   unloadMovieNum(2); // unloadmovie (formularios)
   for (var i=0;i<numOfItems;i++){
      var t:MovieClip = home["item"+i];
      // mostrar os icones nao clicados
      if (t != this._parent){
         var tw:Tween = new Tween(t,"_xscale", Strong.easeOut,0,t.theScale,1,true);
         var tw2:Tween = new Tween(t,"_yscale", Strong.easeOut,0,t.theScale,1,true);
         var tw3:Tween = new Tween(t,"_alpha", Strong.easeOut,0,100,1,true);
      }
      else{
         var tw:Tween = new Tween(t,"_xscale", Strong.easeOut,100,t.theScale,1,true);
         var tw2:Tween = new Tween(t,"_yscale", Strong.easeOut,100,t.theScale,1,true);
         var tw3:Tween = new Tween(t,"_x", Strong.easeOut,t._x,t.xPos,1,true);
         var tw4:Tween = new Tween(t,"_y", Strong.easeOut,t._y,t.yPos,1,true);
   
         tw.onMotionStopped = function() {
            for (var i=0;i<numOfItems;i++){
               var t:MovieClip = home["item"+i];
               t.icon.onRollOver = Delegate.create(t.icon,over);
               t.icon.onRollOut = Delegate.create(t.icon,out);
               t.icon.onRelease = Delegate.create(t.icon,released);
               t.onEnterFrame = mover;
            }
         }
      }
   }
}

function moveTip() {
   home.tooltip._x = this._parent._x;
   home.tooltip._y = this._parent._y - this._parent.height/2;
}

xml.load("icons.xml");

function mover() {
   this._x = Math.cos(this.angle) * radiusX + centerX;
   this._y = Math.sin(this.angle) * radiusY + centerY;
   var s:Number = (this._y - perspective)/ (centerY+radiusY-perspective); //definir aqui a escala de diminuicao
   this._xscale = this._yscale = s * 100;
   this.angle += this._parent.speed;
   this.swapDepths(Math.round(this._xscale) + 100);
}
// Foundation Actionscript animation procurar

this.onMouseMove = function() {
   speed = (this._xmouse-centerX)/4500;
}

//centralizando o fundo

clique._x = centerX-270;
clique._y = centerY+50;
barra._x = centerX;
barra._y = centerY+200;
fundo._x = centerX;
fundo._y = centerY;

var stageL:Object = new Object();
stageL.onResize = function() {
   centerX = Stage.width/2;
   centerY = (Stage.height/2)-15;
   fundo._x = centerX;
   fundo._y = centerY;
   barra._x = centerX;
   barra._y = centerY+200;
   clique._x = centerX-270;
   clique._y = centerY+50;
   alvo._x = centerX;
   alvo._y = centerY;
}

Stage.addListener(stageL);

How To Scale A Mc From Its Center Instead Of Top Left Corner
i am trying to scale an screen centered mc to fill the screen when clicked. when i use the _xscale or _height set properties it scales _x out to the right along the x axis and down along the y axis. basically what i am trying to do is make it grow bigger from the center out, not scale right and down from the top left corner out. how can i do this?? if i make the _x a positive number and then on the next line a negative number, they cancel each other out. there must be some way... hmm... please help!

here is the code i have been using:

redsquare.onEnterFrame = function() {
this._xscale-=(this._xscale-targXscale)/10;
this._yscale-=(this._yscale-targYscale)/10;
};

redsquare.onRelease = function() {
_root.targXscale = 500;
_root.targYscale = 500;
};


its nice when it eases out to the final resting size....
i have tried centering the mc's registration point but that has worked either

Scale Movie To Center By Tween
ok Ive had a really hard time figuring this out, and its driving me crazy. What i am basically going for is an effect like this: http://www.seanjohnblackelite.com/main.htm

Basically its self explained, I need to have it just like that so when the user scales the web browser, it bounces or smoothly slides to the center of the browser, how is this done? I am new to this so if you could explain, or even show an example that would be great! I WOULD GREATLY APPRECIATE IT!!!!! thanks alot!!!!

[F8] How To Scale A Movieclip From The Center Using Actionscript?
Hi, i need to create a dynamic zoom function for a site and i would like to know how to scale a movieclip from the center using actionscript (preferably the tween class).

At the moment im using the tween class to modify the _xscale and _yscale properties but i can only get it to scale from the top left corner, not the center. So what im wondering is if there's any way to modify the transformation point of a movieclip object using actionscript? or is there any other way i can get this to work?

Any help would be great, thx.

Help Implementing Scale/center Code
I'm having trouble implementing it though..







Attach Code

This is the code i want to use

function LoadImage(clip, maxWidth, maxHeight, bordersize, filename) {
clip._alpha = 0;
clip.loadMovie(filename);
onEnterFrame = function() {
if(clip.getBytesLoaded() >= clip.getBytesTotal() && clip.getBytesLoaded() > 4){
// Scale
scaleW = ((maxWidth - (bordersize * 2)) / clip._width);
scaleH = ((maxHeight - (bordersize * 2)) / clip._height);
if (scaleH >= scaleW) { newScale = scaleW; }
else { newScale = scaleH; }
clip._width = clip._width * newScale;
clip._height = clip._height * newScale;
// Center
if (clip._width < maxWidth) { clip._x = (maxWidth/2) - (clip._width/2); }
if (clip._height < maxHeight) { clip._y = (maxHeight/2) - (clip._height/2); }
// Show
clip._alpha = 100;
delete onEnterFrame;
}
};
};




and this is the loadmovie code i'm currently using



function loadGImage(title, bigImgURL)
{
_root.bigImage.imageContainer.loadMovie(bigImgURL, 100);
_root.bigImage.imageContainer._x = 0;
_root.bigImage.imageContainer._y = 0;
_root.title.text = title;
_root.downloadButton.onRelease = function ()
{
getURL(bigImgURL, "_blank");
}
;
}

How To Scale A Movieclip From The Center Outward?
I have a button which I want to scale the movie screen outwards by 125% when someone rolls over it. The problem I am having is that it scrolls from the top left corner instead of from the center outwards. It is important that the screen scales out uniformly from the center. Please provide me with the proper action script code that makes it scale uniformly outwards from the center. Also, if possible, can I make this scale tween from the center outwards using action script? It would make the animation look much more smoother.

Thanks,
Sam

Scale Multiple By Individuals Center?
Is there any way to scale multiple objects from each objects center?

For example I want to make a sentence of letters increase in size then decrease back to original size, one by one, from left to right. When select all of the letters (broken apart) and scale them, they increase in size proportionally to each others distance. I want each one to scale as if I selected them individually. As if to pop out at you.

Scale Video Object From Center
Is it possible to scale a video object from it's center? I am currently using the below code to resize but I need it to scale from the center of the video object.

ActionScript Code:
function resizeVideo() {
video._width = video.width;
video._height = video.height;
}

Can I Position Something Relative To A Browser Window?
i have a flash movie that's 1024 x 768, and it blows up in a full screen popup browser window. all the content (which is just the navigation at this point) stays in the upper left hand corner of the movie; the movie doesn't scale if you're dealing with lower resolution (800 x 600 for instance), it just cuts off the bottom right corner.
i would like to position a movie clip in the bottom right corner of the VISIBLE movie; in other words, dynamically get the window's width and set the position of the clip relative to that. is there any way to get the browser's window width and use it in a flash movie for positioning of clips?
i need something similar to the screen.width method in javascript i guess... or perhaps i can do it with javascript and get it into the movie somehow... help!
thanks for your time,
skwerl
skwerl@bigfoot.com

Photo Pop-up Relative To Mouse Position
Someone can help me.....

I have a sequence of photos. I want to pop-up the photo which is close to the mouse. My main problem is how to make the photo scale according to mouse closeness. I mean i want to make photo more big as the mouse come more near to the photo. At the same time other unselected photos must be pushed to the side and become smaller and fade out. Something like that in photo scroll in the middle of the page http://www.slooz.com/photos.php


Thanks

[F8] Relative Mouse Position Limits
Hi all,

Currently I have an object which uses the mouse relative position to move around a bounded box. The reason why I have done so is that within this bounded box there are some obstacles whereby my mouse-following-object can collide into and be blocked. In those situation the user can just move in the opposite direction to move off the collided object - should I just use the mouse position as a reference then the object will "jump" from point to point when the mouse position is off the blocked range. (I hope till this point I am still understood)

I am using the following code to get the mouse relative position:


Code:
mousePt[0] = _root._xmouse - oldPos[0];
mousePt[1] = _root._ymouse - oldPos[1];
oldPos[0] = _root._xmouse;
oldPos[1] = _root._ymouse;
relPos[0] += mousePt[0];
relPos[1] += mousePt[1];


My problem is now that when I run the application in full screen mode and the mouse cursor to the limit of the screen, then the relative position will not change so the object-following-mouse will be stuck.

eg. Mouse move off left bound of windows screen moving further left will only displace the object up or down but NOT further left. All this while the mouse cursor will be hidded so the user only knows the object position.

Can someone please help me with this relative position offset limit please.

Thanks in advance

How Do U Get A MovieClips Position Relative To The Stage?
I have a movie clip made up of several other movieclips. I'm trying to get the position of the individual movieclips relative to the stage, but i only get it's position relative to it's parent. Exp:

trace(car._x) \ 100
trace(car._wheele._x) \ -33


pls help.

X Position Of MC Within Another MC Relative To The Main Stage?
ok, here's my problem

I'm tryiing to determine the X or Y value of a movie clip that's with another movie clip relative to the main stage. I don't want the value related to the parent clip.

can someone please tell me the syntax? thanks

Using A Tween Function According To Relative Position Of Mc
Hello, I'm using a tween function and I want to move an obect relative to it's current position. Like say, MC15.xSlideTo(MC15._x+10, .6, easeOutExpo);

Here's my code:

ActionScript Code:
function thumbRoll(tagID)
{
    _root["MC"+tagID].xSlideTo(_root.MC[tagID]._x - 10, .6,"easeInExpo");
    _root["MC"+tagID].ySlideTo(_root.MC[tagID]._y + 10, .6,"easeInExpo");

} // End of the function
I want to have one function for all the different clips as there will be 65 clips.
The problem is that the mc moves all the way across the screen.
Here's an example: http://www.metapps.com/testing/areas2.html
rollover the names in the drop down list

Ease And Relative Browser Position.
Hello. The folks at Interone have a very cool effect where their main nav movie clip stays aligned to the right side of the browser window whenever it is resized.

http://www.interone.de/cms/de/

The clip has a nice ease on it -- so it eases back into place whenever the browser is resized. Can anyone walk me through the how-to? (I just want to learn to do the ease/relative browser position thing -- the beautiful "growing plant" and WeFail-style "hover" are for another day

Thank you!

Position Stuff Relative To The Stage
Feel free to use these to help in positioning stuff relative to the Stage. Acts on the registration point of the object.

e.g. if you have a movieclip 200 pixels wide with a lefttop registration point, you have to subtract 200 from rightEdge so it aligns nicely.


Code:
// Size of your flash canvas
var canvasWidth = 550;
var canvasHeight = 400;

var leftEdge = (canvasWidth/2)-(Stage.width/2);
var rightEdge = (canvasWidth/2)+(Stage.width/2);
var topEdge = (canvasHeight-Stage.height)/2;
var bottomEdge = Stage.height - ((Stage.height-canvasHeight)/2);
var centerScreen = (canvasWidth/2) - (menuWidth/2);
Hope this is useful especially for those who have been trying to achieve menus that stays on one side whenever the browser is resized.

Movement Relative To Mouse Position
can anyone help me figure out the code to make something like this? I've managed to make something that's sort of similar but gets buggy when the enlarged image hits the edges.

it also bugs out when I change the image being displayed while the movie is playing but that's a problem for another time.

<edit>
it's pretty much fixed already. the only problem now is when the background image has to shrink back down. its registration point is its center which creates big empty areas when it shrinks.
</edit>

Mouse Position Relative To Stage
I'm having trouble with the mouseX and mouseY values after resizing the stage.

Everything works well with the default size of the window. However, after I resize the window and take my cursor to the left edge of the stage, "mouseX" values are negative. I want the left edge to start from 0 after resize aswell... How is this possible?

Relative Mouse Position With Easing
Here is my cool code....


Code:
onClipEvent(enterFrame)
{

_x -= (-20) - ((0.1 * _xmouse) - 60);
_y -= (-45) - ((0.1 * _ymouse) - 60);

// y boundaries
if (_root.assembled._y > 10) {
_root.assembled._y = 10;
}

if (_root.assembled._y < -10) {
_root.assembled._y = -10;
}
// x boundaries
if (_root.assembled._x > 20) {
_root.assembled._x = 20;
}

if (_root.assembled._x < -20) {
_root.assembled._x = -20;
}
}
Here is an example...
www.frunder.com/showcase.html

Now go ahead and try that on a movieclip named "assembled".

__________________________________________________ _

Here is my question...

How can I make the easing start fast then go slow? Right now it starts slow and speeds up. Well not really, because it speeds up and then slows down once it gets closer to the mouse position. But becuase the mouse position is greater than that of the movement, it seems like it speeds up then just stops!

Here is the effect I am after....

look at the images inside of
www.kelamali.com

I am close, really close.

Any help would be great! I have also tried this post on Kirupa, but no one seems to know what's going on... Including me.

Thanks!!!

Scaling Relative To Mouse Position
My actionscripting must be improving because I know the basics of this, just need a little help.

I have a dragable movie clip that on release I want to scale, depending on the mouse position, the further the mouse up the screen (y) then the smaller the clip scales on release.

Any help would be, as usual, appreciated.

Thanks folks

Relative Mouse Position With Easing
Here is my cool code....


Code:
onClipEvent(enterFrame)
{

_x -= (-20) - ((0.1 * _xmouse) - 60);
_y -= (-45) - ((0.1 * _ymouse) - 60);

// y boundaries
if (_root.assembled._y > 10) {
_root.assembled._y = 10;
}

if (_root.assembled._y < -10) {
_root.assembled._y = -10;
}
// x boundaries
if (_root.assembled._x > 20) {
_root.assembled._x = 20;
}

if (_root.assembled._x < -20) {
_root.assembled._x = -20;
}
}
Here is an example...
www.frunder.com/showcase.html

Now go ahead and try that on a movieclip named "assembled".

__________________________________________________ _

Here is my question...

How can I make the easing start fast then go slow? Right now it starts slow and speeds up. Well not really, because it speeds up and then slows down once it gets closer to the mouse position. But becuase the mouse position is greater than that of the movement, it seems like it speeds up then just stops!

Here is the effect I am after....

look at the images inside of www.kelamali.com

I am close, really close.

Any help would be great!

Thanks!!!

Movie Clip: Relative Position
Hello all! I'm new here. I did a search on the forum but couldn't find an answer for my problem. I apologize if this has been discussed before.

Here's my problem:
I'm building a menu which will get upgraded a lot. There's a movie clip containing buttons with numbers. When pressed, a movie clip with subcategories for a specific number rolls out from beneath the movie clip with numbers and stops where it touches it. I would like to make the position of the roll out menu relative to the end of the numbers menu, so the distance between them would always be the same, no matter how long the numbers menu will get.

Now:
|1 2 3 4 5|

|1 2 3 4 5| |sub2 A sub2 B sub2 C|

In time:
|1 2 3 4 5 6 7 8 9| | sub2 A sub2 B sub2 C|


How to achieve this? I don't know much actionscript and I don't know where to start with this.. Any help is greatly appreciated.


Petra

Position Stuff Relative To The Stage
Feel free to use these to help in positioning stuff relative to the Stage. Acts on the registration point of the object.

e.g. if you have a movieclip 200 pixels wide with a lefttop registration point, you have to subtract 200 from rightEdge so it aligns nicely.


Code:
// Size of your flash canvas
var canvasWidth = 550;
var canvasHeight = 400;

var leftEdge = (canvasWidth/2)-(Stage.width/2);
var rightEdge = (canvasWidth/2)+(Stage.width/2);
var topEdge = (canvasHeight-Stage.height)/2;
var bottomEdge = Stage.height - ((Stage.height-canvasHeight)/2);
var centerScreen = (canvasWidth/2) - (menuWidth/2);
Hope this is useful especially for those who have been trying to achieve menus that stays on one side whenever the browser is resized.

Position MC Relative To Browser Scroll
Here's the situation - I have a swf that is taller than the browser window, so only a portion of it is visible at any time. When necessary, I want to position a mc so that it shows up in the part of the swf that is visible.

So the position would be relative to how far up or down you had scrolled.

Any ideas?

Sliding MC Position Relative To Contents
I have a movie clip that I have given the a "sliding" variable to move it across the X axis.
So far I have been using a variable of
Code:
movieClip.newX = -250;
, but what i need to do is have the movieclip slide to a position which is relative to an object inside of it.

As i need the slider to move to a position that centers the object which the slider contains on centered on the screen - i have tried:
Code:
movieClip.newX = movieClip.ContentsObject.Stage.width/2;
but with no response. I realise that code is incorrect, but need something that will work in that way. I presume i need some sort of listener to follow the _x position of the specific movie clip.

Does that make sense? does anyone know?
cheers,

Scaling Relative To Mouse Position
My actionscripting must be improving because I know the basics of this, just need a little help.

I have a dragable movie clip that on release I want to scale, depending on the mouse position, the further the mouse up the screen (y) then the smaller the clip scales on release.

Any help would be, as usual, appreciated.

Thanks folks

Relative Mouse Position With Easing
Here is my cool code....


Code:
onClipEvent(enterFrame)
{

_x -= (-20) - ((0.1 * _xmouse) - 60);
_y -= (-45) - ((0.1 * _ymouse) - 60);

// y boundaries
if (_root.assembled._y > 10) {
_root.assembled._y = 10;
}

if (_root.assembled._y < -10) {
_root.assembled._y = -10;
}
// x boundaries
if (_root.assembled._x > 20) {
_root.assembled._x = 20;
}

if (_root.assembled._x < -20) {
_root.assembled._x = -20;
}
}
Here is an example...
www.frunder.com/showcase.html

Now go ahead and try that on a movieclip named "assembled".

__________________________________________________ _

Here is my question...

How can I make the easing start fast then go slow? Right now it starts slow and speeds up. Well not really, because it speeds up and then slows down once it gets closer to the mouse position. But becuase the mouse position is greater than that of the movement, it seems like it speeds up then just stops!

Here is the effect I am after....

look at the images inside of www.kelamali.com

I am close, really close.

Any help would be great!

Thanks!!!

Movie Clip: Relative Position
Hello all! I'm new here. I did a search on the forum but couldn't find an answer for my problem. I apologize if this has been discussed before.

Here's my problem:
I'm building a menu which will get upgraded a lot. There's a movie clip containing buttons with numbers. When pressed, a movie clip with subcategories for a specific number rolls out from beneath the movie clip with numbers and stops where it touches it. I would like to make the position of the roll out menu relative to the end of the numbers menu, so the distance between them would always be the same, no matter how long the numbers menu will get.

Now:
|1 2 3 4 5|

|1 2 3 4 5| |sub2 A sub2 B sub2 C|

In time:
|1 2 3 4 5 6 7 8 9| | sub2 A sub2 B sub2 C|


How to achieve this? I don't know much actionscript and I don't know where to start with this.. Any help is greatly appreciated.


Petra

[Newbie] Fullscreen/relative-position Swf
Hello guys,

I need some really basic understanding in how to make a swf like:

www.home-k1.com

The swf is not centered, but rather the content is relative to the user's browser/screen resolution. (look at the contact line at the bottom for example).

I don't even know how to describe it, but I hope you get it
Thanks in advance!

Copyright © 2005-08 www.BigResource.com, All rights reserved