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




Stage Object Scaling



Hey.

Anyone have any insight into how one can scale elements of the movie without scaling others.

Like having some elements be full screen (graphics) and other elements stay with a specified pixel size (fonts).

It is possible, I've seen it. Anyone wanna share?

thanks. :]



Ultrashock Forums > Flash > ActionScript
Posted on: 2002-03-16


View Complete Forum Thread with Replies

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

Stage Scaling And Object Align
im lookin for a decent tutorial or something about how to get this scale/resize effect.

http://www.gskinner.com/site2_5/

http://www.ego7.net/

No Resize/scaling A Movie Clip On The Scaling Stage...
I know this has probably been answered here already, but I've search through all the threads with "scaling" and "resizing" and can't find the solution.

Basically I have a GUI element on a gallery that I don't want to scale, while the rest of the page is free to resize/scale.

I think I need to add a listener of some sort to the stage, but I'm not sure how to do this. If you can point me to a thread where this has already been answered, great! Otherwise I would be grateful for any help you could provide here.

Non-scaling Object In Scaling Movie
Does anyone know - Is it possible to have an movie clip, that retains a fixed pixel size e.g. 200x100 inside a flash movie that scales to 100% to fit browser window?

Stage Scaling?
(my code is at bottom)
A button aligned with the bottom of the stage is desired to remain aligned with the bottom of the stage as the user resizes the window.
As the height of stage is increased -- the _y of the button and the stage._height maintain their differential -- but the visible window shows the button moving faster down -- until its completely beyond the bottom of the window.

Conversely, as the window height is decreased -- the differential remains accurate -- but the button ends up in the middle of the window. Resize to the original stage height -- and the alignment goes back to as it started.

I've gotta be missing something. some sort of constraint or percentage/offset? Anybody know what it is? -- or if there's any easier way to maintain a button/object's alignment as the window/stage resizes?

newbie flasher -- and I can't even get unzipped...

Stage.scaleMode = "noScale"
var myListener:Object = new Object();
myListener.onResize = function () {

trace("Stage size is now " + Stage.width + " by " + Stage.height);
trace(btnNext._y)
btnNext._y = Stage.height - btnNext._height
btnPrevious._y = Stage.height - btnPrevious._height
trace(btnNext._y)

}
Stage.addListener(myListener);








Attach Code

Stage.scaleMode = "noScale"
var myListener:Object = new Object();
myListener.onResize = function () {

trace("Stage size is now " + Stage.width + " by " + Stage.height);
trace(btnNext._y)
btnNext._y = Stage.height - btnNext._height
btnPrevious._y = Stage.height - btnPrevious._height
trace(btnNext._y)

}
Stage.addListener(myListener);

Scaling The Stage But Not The Content
how do you make a flash file that is 100% of your browser size
and resizes with the browser but without the objects in the
movie resizing also?

thanks

Stage Scaling Problem
(Using CS3, with AS2.0)
I'm working on a personal site at www.nickelcadmium.net

I'm happy with the progress so far, but I'm having one major problem: The .swf isn't scaled, which I want because I like the background filling the entire screen. However, the main blue box interface scales the same size, reguardless of browser resolution.

In some browsers some of the navigation is getting cut off when the interface "zooms in."


I'd like for the background to stay full, but for the blue box interface to be limited to scale differently depending on different browser resolutions, so that I can guarantee how much of it each user sees.

What would you suggest?

Scaling To Center Of Stage
OK so I am new to the actionscript world and I am struggling to get something to work. I have been searching the web and I don't know if it is because I am new and not sure what I am looking for...or I have over looked something easy...but here is what is going on...

I have a movie clip called "schemLoader_MC" and a user can zoom in and out of it by using a plus or minus button I have created. I am trying to make it so that when you click the plus or minus button it will zoom to the center of the stage.

How do I make the following scale to the center of the stage regardless of the position of the movie it is scaling? The "schemLoader_MC" can be zoomed in or out and can pan in any direction as well...

Here is the current code I have...it functions...just not like I would like it to:

// Zoom in button
zoomIn_btn.onPress = function() {
schemLoader_MC._xscale *= 1.20;
schemLoader_MC._yscale *= 1.20;
};

// Zoom out button
zoomOut_btn.onPress = function(): {
schemLoader_MC._xscale *= .8;
schemLoader_MC._yscale *= .8;
};

Dynamically Scaling The Stage
I have had a wonderful tool in AS2 where I can take this movieClip, resize it and move it off the stage, and at run time, only what the movieClip is over is seen and at full screen. I would absolutely love it if anyone could help me get it to work in AS3. Here is the AS2 code:

function camControl():Void {
parentColor.setTransform(camColor.getTransform());
var scaleX:Number = sX/this._width;
var scaleY:Number = sY/this._height;
_parent._x = cX-(this._x*scaleX);
_parent._y = cY-(this._y*scaleY);
_parent._xscale = 100*scaleX;
_parent._yscale = 100*scaleY;
}
function resetStage():Void {
var resetTrans:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
parentColor.setTransform(resetTrans);
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
}
// make frame invisible
this._visible = false;
// Capture stage parameters
var oldMode:String = Stage.scaleMode;
Stage.scaleMode = "exactFit";
var cX:Number = Stage.width/2;
var cY:Number = Stage.height/2;
var sX:Number = Stage.width;
var sY:Number = Stage.height;
Stage.scaleMode = oldMode;
// create color instances for color
// transforms (if any).
var camColor:Color = new Color(this);
var parentColor:Color = new Color(_parent);
// Make the stage move so that the
// v-cam is centered on the
// viewport every frame
this.onEnterFrame = camControl;
// Make an explicit call to the camControl
// function to make sure it also runs on the
// first frame.
camControl();
// If the v-cam is ever removed (unloaded)
// the stage, return the stage to the default
// settings.
this.onUnload = resetStage;

Here is the code I have so far in AS3, but I've been stuck for a while on this:

function camControl():void {
parentColor.setTransform(camColor.getTransform());
var scaledX:Number = sX/this.width;
var scaledY:Number = sY/this.height;
parent.x = cX-(this.x*scaledX);
parent.y = cY-(this.y*scaledY);
parent.scaleX = 100*scaledX;
parent.scaleY = 100*scaledY;
}
function resetStage():void {
var resetTrans:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
parentColor.setTransform(resetTrans);
parent.scaleX = 100;
parent.scaleY = 100;
parent.x = 0;
parent.y = 0;
}
// make frame invisible
this.visible = false;
// Capture stage parameters
var oldMode:String = Stage.scaleMode;
Stage.scaleMode = "exactFit";
var cX:Number = Stage.width/2;
var cY:Number = Stage.height/2;
var sX:Number = Stage.width;
var sY:Number = Stage.height;
Stage.scaleMode = oldMode;
// create color instances for color
// transforms (if any).
var camColor:Color = new Color(this);
var parentColor:Color = new Color(parent);
// Make the stage move so that the
// v-cam is centered on the
// viewport every frame
this.onEnterFrame = camControl;
// Make an explicit call to the camControl
// function to make sure it also runs on the
// first frame.
camControl();
// If the v-cam is ever removed (unloaded)
// the stage, return the stage to the default
// settings.
this.onUnload = resetStage;

I'd appreciate any help.

Scaling Clip According To Stage
I found this code to scale a MovieClip proportionately to the stage resize. This works great but I’m trying to have a space at the top and bottom each of 60 pixels. I can get this on the top by setting my y value to 60 but I need to get that same space on the bottom. How can I go about this? I tried subtracting 60 from the stage height. I also tried subtracting it from the clips height but it didn't work.

Any solutions would be welcomed


ActionScript Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
this.createEmptyMovieClip("mcBackground", 1);
mcBackground._y=40;

function stageResize():Void {
    //if (Stage.width>640 && Stage.height>480) {
        var imageAspectRatio = mcBackground._width/mcBackground._height;
        var stageAspectRatio = Stage.width/Stage.height;
        if (stageAspectRatio>=imageAspectRatio) {
            // long skinny stage - match image width and adjust height to fit
            mcBackground._width = Stage.width;
            mcBackground._height = Stage.width/imageAspectRatio;
        } else {
            // tall narrow stage - match image height and adjust width to fit
            mcBackground._height = Stage.height;
            mcBackground._width = Stage.height*imageAspectRatio;
        }
        //mcBackground._width = Stage.width;
        //mcBackground._height = Stage.height;
        mcBackground.updateAfterEvent();
    //}
}
var stageListner:Object = new Object();
stageListner.onResize = function():Void  {
    stageResize();
};

Scaling MC's Within Stage Size
hey guys,
Im having a problem here. I have an MC which loads images from an xml file.
Most of them pictures are quite big (800×600) and i know some people still run that resolution. So the problem is if the browser window is smaller then those dimensions people cant see the full pic. So now my question was, does someone know how to scale them down, without stretching the pic. Thus not:

myMc._width = Stage.width;
myMc._height = Stage.height;

but something like http://www.manipulator.com/
where the _xscale = _yscale;

Does anyone have a clue how to write this?

Scaling A Growing Mc To Always Fit The Stage
Hi!

What I´m trying to do is load images (currently boxes in different colors) into a mc which is supposed to scale down so it always fits the stage. If the "holder" clip is smaller then the stage it should just center itself. The boxes places themselfs in contact with the previous box, thats what the "typeOfBound" function is for basicly.

I´m having trouble with the scaling value, it works fine on the first couple of boxes. You can just copy paste the code to try it for yourself. Hope you understand where I´m going with this.

And sorry about the crappy spelling.

// Rickard


Code:

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

var list:Object = new Object();
Stage.scaleMode = "noScale";
Stage.align = "LT";
Stage.addListener(list);


/* ----------------------------------------------------------*/
// RANDOM POSITIONING

var holder:MovieClip;
var imageRef:Array = new Array();
var probability:Array = new Array();
var prevX:Number = 0;
var prevY:Number = 0;
var prevW:Number = 0;
var prevH:Number = 0;
var bound:Number = 3;
var previousX:Number = 0;
var previousY:Number = 0;
var fakeDown:Number;
var rS:Number = 100;
var nX:Number = 0;
var nY:Number = 0;

//holder = createHolder(this);
holder = this.createEmptyMovieClip("holder", this.getNextHighestDepth());

// Fakes the load process for the images
fakeDown = setInterval(this, "simulateLoad", 2000, holder);
function simulateLoad():Void{
   clearInterval(fakeDown);
   var mc = createBox(holder);
   imageRef.push(mc);
   typeOfBound(mc);
}



function typeOfBound(mc:MovieClip):Void{
   switch(bound){
      case 1 :
      bound = position(0, 2);
      if(prevY-mc._height*(rS/100) < 0){
         // -1 to prevent effecting the current image
         var offset:Number = (mc._height*(rS/100)-prevY);
         for(var i:Number = 0; i < imageRef.length-1; i++){
            imageRef[i]._y += offset;
         }
         holder._y -= offset;
         previousY = holder._y;
         prevY += offset;
      }
      if(mc._width < prevW){
         mc._x = prevX + (prevW - mc._width);
      }else{
         mc._x = prevX;
      }
      mc._y = prevY - mc._height;
      break;
      
      case 2 :
      bound = position(0, 3);
      if(prevY-mc._height*(rS/100) < 0){
         var offset:Number = (mc._height*(rS/100)-prevY);
         for(var i:Number = 0; i < imageRef.length-1; i++){
            imageRef[i]._y += offset;
         }
         holder._y -= offset;
         previousY = holder._y;
         prevY += offset;
         
      }
      mc._x = prevX + prevW;
      mc._y = prevY - mc._height;
      break;
      
      case 3 :
      bound = position(0, 4);
      mc._x = prevX + prevW;
      mc._y = prevY;
      break;
      
      case 4 :
      bound = position(1, 4);
      mc._x = prevX + prevW;
      mc._y = prevY + prevH;
      break;
      
      case 5 :
      bound = position(2, 4);
      if(mc._width < prevW){
         mc._x = prevX + (prevW - mc._width);
      }else{
         mc._x = prevX;
      }
      mc._y = prevY + prevH;
      break;
   }
   prevX = mc._x;
   prevY = mc._y;
   prevW = mc._width;
   prevH = mc._height;
   reScale();
}

function position(sValue:Number, eValue:Number):Number{
   return Math.ceil((Math.random()*eValue)+sValue);
}

function reScale():Void{
   if(holder._width<Stage.width && holder._height<Stage.height){
      nX = (Stage.width-holder._width)/2;
      nY = (Stage.height-holder._height)/2;
   }else if(holder._width/Stage.width > holder._height/Stage.height){
      rS = (Stage.width/holder._width)*rS;
      nY = (Stage.height - holder._height*(rS/100))/2;
      nX = 0;
   }else{
      rS = (Stage.height/holder._height)*rS;
      nX = (Stage.width - holder._width*(rS/100))/2;
      nY = 0;      
   }
   new Tween(holder, "_xscale", Strong.easeInOut, holder._xscale, rS, 1.8, true);
   new Tween(holder, "_yscale", Strong.easeInOut, holder._yscale, rS, 1.8, true);
   new Tween(holder, "_x", Strong.easeInOut, holder._x, nX, 1.8, true);
   new Tween(holder, "_y", Strong.easeInOut, holder._y, nY, 1.8, true);
   previousX = nX;
   previousY = nY;
   fakeDown = setInterval(this, "simulateLoad", 2000, holder);
}

function createBox(host:MovieClip):MovieClip{
   var w:Number = Math.round((Math.random()*25)+200);
   var h:Number = Math.round((Math.random()*25)+200);
   var mc:MovieClip = host.createEmptyMovieClip("box_"+host.getNextHighestDepth(), host.getNextHighestDepth());
   mc.beginFill(0x000000, 90);
   mc.lineTo(w, 0);
   mc.lineTo(w, h);
   mc.lineTo(0, h);
   var col = new Color(mc);
    col.setRGB(Math.floor(Math.random()*0xFFFFFF));
   return mc;
}

function createHolder(host:MovieClip):MovieClip{
   var mc:MovieClip = host.createEmptyMovieClip("holder_"+host.getNextHighestDepth(), host.getNextHighestDepth());
   mc.beginFill(0xFF0000, 100);
   mc.lineTo(10, 0);
   mc.lineTo(10, 10);
   mc.lineTo(0, 10);
   return mc;
}

Position Object By Center Of Other Object And Stage Left...?
lol! :lol:

what i mean is i have an object (mc = main_logo) that centers itself upon load:

main_logo._x = Stage.width / 2;
main_logo._y = Stage.height / 2;

and i want another object (mc = helmet) to always load up 2/3rds to the left (x axis) of main_logo's center (counting left to right, 2/3rds between main_logos center and stage left border) and 200 pixels above (y axis) main_logo's center.

i know i keep asking these things and i'm not trying to have you all do every little thing for me, i am trying to learn this! it's just that my brain operates differently and i have to assimalate information by what i'm trying to accomplish...

thanks!

[MX04] Scaling The Main Stage
Hey Gang,

Working on a project that is essentially one large stage (16:9 ratio) that will play 2 movies (4:3 ratio) side by side. These movies are loaded externally by two separate XML files that act as play lists. Everything works great, and I've worked out the kinks except for one.

This flash file is going to be played on large plasma screens and plays at a rather large resolution. The difficulty comes in when an end user is changing the xml files and wants to double check that everything works correctly. Currently, the demo runs at fullscreen with allowscale set to false. Because most of these end users are going to be viewing this on laptops and monitors set to a much lower resolution than the final output, I'm trying to set up a key listener that will upon hit, scale the WHOLE stage of the flash down to say 30% or so, and then back up to 100% when it's hit again, or another key is pressed. Similar to what happens when you toggle allowscale on or off in fullscreen mode, but with a target size that's smaller than the normal stage size. I can't shrink the stage size on the fla because one of the screens requires playback at exactly 100% or I get artifacts all over the place. So during normal playback allowscale is already off, and the movie is playing at 100% size.

Can anyone help me out here or point me in the right direction? I've seen Stage.scale.[string] but that seems to only allow for scale versus no scale and it's dependant upon the window dimensions it's being viewed inside. This is a fullscreen presentation, and I wanted to avoid going into a windowed mode.

So to recap: I'm looking for a key listener function that will change the entire scale of the stage rather than just a particular movieclip.

Any thoughts?

Scaling Stage Mask Dynamically
Hi Guys,
Got a slight problem with getting a mask that covers my stage to scale when the browser window is resized.
Basically when the browser window is resized i need the stage to resize with it, and the mask that covers the stage to resize with it to, so it shows more and more of the bg and elements can scale to the width of the entire stage.

Heres where i am on the first frame of the main timeline:

stop();
Stage.align = "TL";
Stage.scaleMode = "noScale";

sizeListener = new Object();
sizeListener.onResize = function() {
_root.mc_menu_all.mc_menu_bg._width = Stage.width;
_root.mc_menu_all._y = Stage.height/1.7;
_root.mc_logo._y = _root.mc_menu_all._y+80;
_root.mc_mask_main._width = Stage.width;
_root.mc_mask_main._height = Stage.height;
};
Stage.addListener(sizeListener);

I don't know if it matters whether i have more than 1 frame on the root timeline, or whether i have to call the script everytime?

If anyone can help with why the above code is not working its much appreciated (got a presentation tomorrow!

Can be seen here http://testsite.imageview.co.uk/djh/site.html

Cheers,
Pat

Stage Resize And Scaling Movieclips
how do I code stage resize with scaling movieclips?
I can do stage resize and position/scale movieclips relative to stage size..
but i don't how to have a scalable movieclip retain its scale relative to stage size.
how do I code this?

for example, i have a movieclip originally 50px wide, and the stage 100px wide..
when i click the mc, it scales up to 80px wide. and when I resize the stage to 50px,(50% of stage size) i want the mc to scale to 40px too(50% of mc size).. and when I click it again to restore to it's original size, i want it to scale to 25px(50% of original size). then finally when i scale the stage back to 100px, the mc again is 50px wide.

i hope i made sense.. any help and links would be great.

Stage Alignment Problem Upon Scaling
I am having an issue with alignment within my flash file with a certain part of the flash. I setup a sample version of what I am having the issue with. You can view what I am talking about here: http://www.arteye.com/testme/ (this just emulates the problem I am having)

If you resize the browser when the section with the green box and red bar at the top, you will see they move to the center just like I would like. Next click on the red bar and this will take you to an example of a carousel script I am working with. Now if you resize this section - you will see that it is throwing the content hard to the left and really screwing things up. Why is this happening?

I know you guys are going to want to see code - so here is what I have in the main movie:


Code:
stop();

Stage.scaleMode = "noscale";
Stage.align = "TL";

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

//Center movieClip reusable function
function centerMC(mc:MovieClip):Void {

mc._x = Math.floor((Stage.width - mc._width) / 2);

}

//Fade in or out reusable function
function fadeMc(mc:MovieClip, newAlpha:Number, duration:Number):Void {

var mcAlpha:Number = mc._alpha;
var fade:Tween = new Tween(mc, "_alpha", Regular.easeOut, mcAlpha, newAlpha, duration, false);

}

//Reposition elements
function reposition():Void {

centerMC(mcholder);
bkgScale();

};

Stage.addListener({onResize:reposition});

//Scale Background
function bkgScale():Void {

// This is the proportion (width/height) of the image
var imageScale:Number = bkgHolder._width/bkgHolder._height;

// This is the proportion (width/height) of the stage
var stageScale:Number = Stage.width/Stage.height;

// If the stage scale is bigger than the image scale the images width resizes to the stage
// width and the image height takes the stage proportion
if (stageScale>=imageScale) {

bkgHolder._width = Stage.width;
bkgHolder._height = Stage.width/imageScale;

// If the stage scale is smaller than the image scale the images height resizes to the stage
// height and the image width takes the stage proportion
} else {

bkgHolder._height = Stage.height;
bkgHolder._width = Stage.height*imageScale;
}

}

/////////////Loader//////////////////////
var loaderListener:Object = new Object();
//When loading starts turn the loaded clip alpha to 0
loaderListener.onLoadStart = function(mc:MovieClip):Void {

mc._alpha = 0;

};
//When the first frame of the loaded clip have been executed
loaderListener.onLoadInit = function(mc:MovieClip):Void {
//if it is the background
//scale background
//and load the external mc with a 1000 miliseconds delay
// so the appearing of the elements seem more smooth
if (mc == bkgHolder) {

bkgScale();

setTimeout(loadMc, 1300);

}

//if it is the external mc
//center it
else if (mc == mcholder) {

centerMC(mc);
}

//Tween the loaded alpha to 100
fadeMc(mc, 100, 28);

};

var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(loaderListener);
//Load external MC
function loadMc():Void {

loader.loadClip("sgcore.swf", mcholder);

}
//Load background image
function loadBKG():Void {

loader.loadClip("background.jpg", bkgHolder);

}
//Start Loading
loadBKG();

Stage Alignment Problem Upon Scaling
I am having an issue with alignment within my flash file with a certain part of the flash. I setup a sample version of what I am having the issue with. You can view what I am talking about here: http://www.arteye.com/testme/ (this just emulates the problem I am having)

If you resize the browser when the section with the green box and red bar at the top, you will see they move to the center just like I would like. Next click on the red bar and this will take you to an example of a carousel script I am working with. Now if you resize this section - you will see that it is throwing the content hard to the left and really screwing things up. Why is this happening?

I know you guys are going to want to see code - so here is what I have in the main movie:


Code:
stop();

Stage.scaleMode = "noscale";
Stage.align = "TL";

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

//Center movieClip reusable function
function centerMC(mc:MovieClip):Void {

mc._x = Math.floor((Stage.width - mc._width) / 2);

}

//Fade in or out reusable function
function fadeMc(mc:MovieClip, newAlpha:Number, duration:Number):Void {

var mcAlpha:Number = mc._alpha;
var fade:Tween = new Tween(mc, "_alpha", Regular.easeOut, mcAlpha, newAlpha, duration, false);

}

//Reposition elements
function reposition():Void {

centerMC(mcholder);
bkgScale();

};

Stage.addListener({onResize:reposition});

//Scale Background
function bkgScale():Void {

// This is the proportion (width/height) of the image
var imageScale:Number = bkgHolder._width/bkgHolder._height;

// This is the proportion (width/height) of the stage
var stageScale:Number = Stage.width/Stage.height;

// If the stage scale is bigger than the image scale the images width resizes to the stage
// width and the image height takes the stage proportion
if (stageScale>=imageScale) {

bkgHolder._width = Stage.width;
bkgHolder._height = Stage.width/imageScale;

// If the stage scale is smaller than the image scale the images height resizes to the stage
// height and the image width takes the stage proportion
} else {

bkgHolder._height = Stage.height;
bkgHolder._width = Stage.height*imageScale;
}

}

/////////////Loader//////////////////////
var loaderListener:Object = new Object();
//When loading starts turn the loaded clip alpha to 0
loaderListener.onLoadStart = function(mc:MovieClip):Void {

mc._alpha = 0;

};
//When the first frame of the loaded clip have been executed
loaderListener.onLoadInit = function(mc:MovieClip):Void {
//if it is the background
//scale background
//and load the external mc with a 1000 miliseconds delay
// so the appearing of the elements seem more smooth
if (mc == bkgHolder) {

bkgScale();

setTimeout(loadMc, 1300);

}

//if it is the external mc
//center it
else if (mc == mcholder) {

centerMC(mc);
}

//Tween the loaded alpha to 100
fadeMc(mc, 100, 28);

};

var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(loaderListener);
//Load external MC
function loadMc():Void {

loader.loadClip("sgcore.swf", mcholder);

}
//Load background image
function loadBKG():Void {

loader.loadClip("background.jpg", bkgHolder);

}
//Start Loading
loadBKG();

Scaling Clip To Stage Width
ActionScript Code:
box._x = 0;
box._xscale = Stage.width;
trace(box._width);


when i test the above script, my movie clip doesnt scale to the the stages width. Any thoughts?

Scaling An Mc Relative To Stage Size
No... it's got nothing to do with egotistical newbie dj's...

I have a projector which I would like to go full-screen. In this projector I plan to play a video in the centre of the stage.

Since people using this preso will have differing screen resolutions, the stage will undoubtedly appear at several different sizes.

I don't want the video to scale, so I'll need it to detect the stage size and adjust its size using a specific ratio.

I've tried using Stage.addListener to detect the onResize() event, but Stage.scaleMode must be set to "noScale" for this to work. This screws my plan to have the stage scaleable.

How do I scale my video relative to the stage size?

Any help would be much appreciated!

Scaling Stage With Size Listener
im using the following code to keep my menus in view when the browser is resized. [code]

stage.showmenu = false;

Stage.scaleMode ="noScale";
Stage.align = "TL";

bottomrightmenu._x = Stage.width
bottomrightmenu._y = Stage.height - bottomrightmenu._height
bottomleftmenu._y = Stage.height - bottomleftmenu._height
toprightmenu._x = Stage.width - toprightmenu._width
center._x = (Stage.width + 800)/2
center._y = Stage.height/2
sizeListener = new Object();
sizeListener.onResize = function() {

bottomrightmenu._x = Stage.width
bottomrightmenu._y = Stage.height -bottomrightmenu._height
bottomleftmenu._y = Stage.height - bottomleftmenu._height
toprightmenu._x = Stage.width - toprightmenu._width
center._x = (Stage.width + 800)/2
center._y = Stage.height/2

};
Stage.addListener(sizeListener);

stop();

on my main stage, on a layer beneath the menus, i have an empty movie clip that i'm loading background swf's in and out of.

my question is.......how do i get the background swfs to scale down in size when the browser size is decreased and scale up in size when the browser is enlarged, while still maintaining the "noScale" mode of the stage?

an example of what im trying to do can be seen here:

http://www.whatireallydoatwork.com/

thanks
brandon

Advanced Actionscript? Problem W/stage And Scaling
This is what I want to do:
1) have a "holder" swf that contains the background img and SCALES to fit the browser window.
2) have the "main" swf inside the holder that DOES NOT SCALE with the holder.

An example can be found here:
www.olivier-baldissera.com

so far I've been able to scale the holder to fit the window as I wanted using the "noborder" and 100%x100% html attributes. I've been fooling with the stage.onResize function and listeners, but they don't seem to work right, partly because I don't think they're supposed to be used with "noborder" set to true.

PLEASE HELP!

Positioning And Scaling A Movieclip In Relation To The Stage...
I'm using the "Full Browser Flash" technique and all is working well with one exception, I can't seem to get a movieclip to scale itself to the stage size and then animate.

Example:

I have a movieclip that spans the width of the stage. The code to implement this technique for the FBF stage is working. What I want to do is 1) detect what the size of the stage is, 2) position the movieclip off of the stage using the detected stage size [i.e.: (._x=0-Stage.width)] and 3) animate this movieclip from it's off screen location to it final position.

Let's say the stage size is detected to be 800 pixels wide. This would scale the movieclip to 800 pixels wide. Then the movieclip would be positioned off the stage at an x coordinate of -800. Then the movieclip would animate to the x coordinate of 0.

Make sense?

Please advise. Thanks.

Scaling Ratio In A GradientFill On Stage Resize
When my document class is initialized, I'm drawing a rectangle with a gradient fill equal to the size of the stage to give me a black -> gray gradient background. I'm also rotating the gradient fill to give me a vertical linear gradient.

I have added a RESIZE event listener to the stage that redraws the rectangle on RESIZE. Its working fine, but I noticed that my ratios scale with the size of the browser.

My goal is to keep the point where the gradient starts at the same y position (lets say 200px).

here is my code...


Code:
package{
import flash.display.GradientType;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Matrix;

public class site extends MovieClip{
var matrix:Matrix = new Matrix;

public function site(){
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
init();
}

private function init():void{
drawBG();
stage.addEventListener(Event.RESIZE,drawBG);
}

private function drawBG(evt:Event = null):void{
matrix.createGradientBox(stage.stageWidth,stage.stageHeight,Math.PI/2,0,0);
graphics.clear();
graphics.beginGradientFill("linear",[0x000000,0x000000,0xCCCCCC],[1,1,1],[0,50,255],matrix);
graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
graphics.endFill();
}
}
}

Help Proportional Scaling MovieClips Relative To Stage
Hello
I need some assistance on how to proportionally scale multiple movieClips relative to the stage size.

I understand movieclip placement relative to the stage, and I have been using a code to scale MovieClips as a fullscreen background (also proportionally)

But

I can not figure out for the life of me how to scale other movieclips in relation
to the stage size.

for example I have a background_mc that proportionally scales with the stage
to fill without distortion.

HOW do I then place another MC say center aligned (I know how to do that) that will scale with the background without distortion?

Ideally I would like to place several MC's on my stage all scaling in proportion with the stage yet independently.

I have not been able to find any documentation on this.
lots of tutorials on backgrounds and color fills and the like but nothing
on proportional scaling of independent mc's

this is the code I use for my background_mc (can it be modified or should it be thrown out the window to achieve independent scaling?)


Code:

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);


//function to handle background image resize.
function setBackground() {
var reg2 = stage.stageWidth / 2;
var reg1 = stage.stageHeight / 2;
bg_mc.x = reg2;
bg_mc.y = reg1;
bg_mc.width = stage.stageWidth;
bg_mc.height = stage.stageHeight;
bg_mc.scaleX <= bg_mc.scaleY ? (bg_mc.scaleX = bg_mc.scaleY) : (bg_mc.scaleY = bg_mc.scaleX);

}
setBackground();

function resizeHandler(event:Event):void {
setBackground();
thanks

Change Stage Size In Web Browser Without Scaling
I need to change the stage's size without auto scaling (i.e. cropping is ok) so that the user can scroll up/down the stage either with the browser's scrollbars or custom scroll bars I create. The height of the swf's contents change and so I need to change the stage's size or somehow crop it so that it would match the browser's size.

Help Proportional Scaling MovieClips Relative To Stage
Hello
I need some assistance on how to proportionally scale multiple movieClips relative to the stage size.

I understand movieclip placement relative to the stage, and I have been using a code to scale MovieClips as a fullscreen background (also proportionally)

But

I can not figure out for the life of me how to scale other movieclips in relation
to the stage size.

for example I have a background_mc that proportionally scales with the stage
to fill without distortion.

HOW do I then place another MC say center aligned (I know how to do that) that will scale with the background without distortion?

Ideally I would like to place several MC's on my stage all scaling in proportion with the stage yet independently.

I have not been able to find any documentation on this.
lots of tutorials on backgrounds and color fills and the like but nothing
on proportional scaling of independent mc's

this is the code I use for my background_mc (can it be modified or should it be thrown out the window to achieve independent scaling?)

Code:


import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);


//function to handle background image resize.
function setBackground() {
   var reg2 = stage.stageWidth / 2;
   var reg1 = stage.stageHeight / 2;
   bg_mc.x = reg2;
   bg_mc.y = reg1;
   bg_mc.width = stage.stageWidth;
   bg_mc.height = stage.stageHeight;
   bg_mc.scaleX <= bg_mc.scaleY ? (bg_mc.scaleX = bg_mc.scaleY) : (bg_mc.scaleY = bg_mc.scaleX);
   
}
setBackground();

function resizeHandler(event:Event):void {
   setBackground();


thanks

[F8] Scaling An Object....
Hello!
I am trying to scale a object that will expand behind a menu link. I am doing an interpretation from this amazing site. If you go there and mouse over the Menu link you will see what I am talking about. I want to be able to move that color bar across the scene I guess with actions script rather than masks and tweens.
http://www.iamalwayshungry.com/
Any thoughts?

Thanks!

Background Images For Different Aspect Ratios With Stage Scaling
Hi all!
I'm designing a flash website which uses a fluid layout (using listeners to reposition the stage elements when the browser is resized). For this I've used a background image which has a resolution of 1600 x 1200. The bg image looks okay on monitors which have an aspect ratio of 4:3 but looks terrible (squashed and distorted) on wide screen monitors.
I was wondering, is there any workaround to this?
Thanks!

AS3 - Content Centering/stretching/scaling On Stage Resize?
Hi guys,

I'm trying to develop a Flash site that has these characteristics:

1. Populates 100% of browser window real estate.
2. Holds content that is unscalable, but stays centered no matter how large the window is.
3. Also has content that stretches (header and footer) to the width of the window, but doesn't scale vertically.

I have an idea of how to do each of these in AS3, but every time I've attempted them I usually end up failing horribly.

Can anyone tell me a "best practice" method for pulling this off?

Moving An Object Thats Off The Stage Onto The Stage
For a Flash class thats coming up we need to do a little game. Now my idea is to make a GTA 1 style game. We have the car movements down but what i'm having trouble with is making the car stay centered and moving objects that arnt currently onto the screen onto the screen. EG Car is in the center (Always stays in the center) Car moves forward, the background (Road, buildings etc...)Move down the screen and new objects apear on top the screen and move downwards or right, left upwards depending on the direction the car is moving. Any help would be greatly appericated.

Embedded Video And Scaling To Stage While Maintaing Aspect Ratio
Hi folks, I have a question about the best way to achieve a video scaling deal I'm trying to do. You can see what I have so far here:

http://www.sans-concept.com/AdamBlog/

The SWF I have at the top is currently 1024x240 pixels in size, but when I'm done it'll be 100% wide and 240 pixels tall. What I want to do is have the video running in that SWF scale with the browser window to always fill that SWF horizontally. The actual video is 640x480 pixels, but I'm cropping out the top and bottom with the SWF.

When the window is resized, I'd like for the video to maintain its aspect ratio as its scaled. That is to say, the SWF will always be 240 pixels tall, but the video inside it should scale proportionally to its original 640x480 size.

Can anyone help me with the best way to do this?

Loader Component Scaling Content To Include Off Stage Items
Hi everyone!
I'm trying load an external swf file into a loader component and it works great. However when that external swf file has an asset off-stage (that can't be deleted) the loader component will scale down the external swf and the off-stage assets are viewable in the main swf. Can anyone offer some help?

Thanks,
Rolando

Scaling A Rotated Object
I have a problem with Flash, where I want to modify a movie clip's '_width' property.

Obviously this works fine when the movie clip's rotation is set to zero, however, as soon as you rotate the object you can no longer stretch it purely by its width. Flash automatically restrains the proportions of the clip, even when I want the clip to be stretched!

<see attached example>


Does anyone know a way around this??

Object NOT Scaling From Center...why?
hey guys,

i am using the prototype function to create the "elastic" effect for a movieclip but the problem i am experiencing is that the movieclip is not growing/shrinking from the center registration point. instead it is scaling from the top left.

here is the code i have on the first and only frame of my main movie:


Code:
movieclip.prototype.elastic = function(newSize, springLength, elasticity) {
xScale = (xScale * springLength) + (newSize - this._xscale) * elasticity;
yScale = (yScale * springLength) + (newSize - this._yscale) * elasticity;
this._xscale += xScale;
this._yscale += yScale;
};
myMC.onEnterFrame = function() {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
elastic(150, 0.85, 0.1);
}
else{
elastic(100, 0.85, 0.1);
}
};


then i just have a movieclip that is a basic square (registered and aligned to the center) and is called "myMC".

ths elastic effect works, it just pops out from the top left instead of the center.

does anyone know why this is happening?

for the record, i am exporting this as flash player 6.

Interactive Object Scaling
I have a box that I want to be able to scale by grabbing and moving the top and/or sides. I created a line for each side of the box and converted them to buttons, but I can't get the actionscript right. I can get the box to change scale by applying the _yscale for the top and bottom and _xscale to the sides, but it only changes in increments that are specified. How can I change the scale dynamically with the mouse?

Thanks

Dynamically Scaling An Object
I managed to scale a movie clip's width with easing.
With this code:

onClipEvent (enterFrame) {
endWidth = 50;
_width += (endWidth-_width)/speed;
}

But it scales both from left and right sides i just want the left to be stable and right to scale.Shortly A box which width is 200 will become 50 but the scale will be from the right.

How am i going to do this?

Dynamic Scaling An Object
i played with dynamic scaling script, but i cant do it

how is possible to create action - e.g. on roll over scale from 100% to 150%

i want use it for my map thank you

Scaling An Object With Mx.transitions
Hey all,

Does anyone know how to scale an object (both height AND width) with mx.transitions? Is the only way to have 2 lines tweening the _xscale and _yscale at the same time? I hope not cuz I notice that this sometimes scales one linefaster than thetother and warps the image....

Hope someone can help...

sloppy:


PHP Code:



var car_twn = new mx.transitions.Tween(_root.main_screen.main_car, "_xscale", mx.transitions.easing.Regular.easeIn, _root.main_screen.main_car._xscale, 80, 350, false); 

var car2_twn = new mx.transitions.Tween(_root.main_screen.main_car, "_yscale", mx.transitions.easing.Regular.easeIn, _root.main_screen.main_car._yscale, 80, 350, false); 

Scaling An Object With Mx.transitionsHey All,
Hey all,

Does anyone know how to scale an object (both height AND width) with mx.transitions? Is the only way to have 2 lines tweening the _xscale and _yscale at the same time? I hope not cuz I notice that this sometimes scales one linefaster than thetother and warps the image....

Hope someone can help...

sloppy:


PHP Code:



var car_twn = new mx.transitions.Tween(_root.main_screen.main_car, "_xscale", mx.transitions.easing.Regular.easeIn, _root.main_screen.main_car._xscale, 80, 350, false);

var car2_twn = new mx.transitions.Tween(_root.main_screen.main_car, "_yscale", mx.transitions.easing.Regular.easeIn, _root.main_screen.main_car._yscale, 80, 350, false); 

Dynamically Scaling An Object
I managed to scale a movie clip's width with easing.
With this code:

onClipEvent (enterFrame) {
endWidth = 50;
_width += (endWidth-_width)/speed;
}

But it scales both from left and right sides i just want the left to be stable and right to scale.Shortly A box which width is 200 will become 50 but the scale will be from the right.

How am i going to do this?

Dynamic Scaling An Object
i played with dynamic scaling script, but i cant do it

how is possible to create action - e.g. on roll over scale from 100% to 150%

i want use it for my map thank you

Following The Edge (_x) Of An Object When Scaling
Hi,

I've got some action script that scales an object by using _xscale, and want another object to follow the right edge, and another to follow the right. I thought that I could just do this:

[code]

mainObject_mc.onEnterFrame = function() {
this._xscale += (1000 + this._xscale)/2;
}

rightFollower_mc.onEnterFrame = function() {
this._x = mainObject_mc._x + mainObject_mc._width;
}

leftFollower_mc.onEnterFrame = function() {
this._x = mainObject._x;
}

But this is not working. I have a feeling that it's because I'm using scale and not width, but that does gic the results I want for the main object, which is scale from the center. Does anyone know what to do?

Matt

Scaling Object From Database Fed Number
im trying to create a bar this is scaled horoontaly based on a number given by an outside db, i cant quite seem to get it to scale..
this is what i have


in the swf
_root.mc_width =_root.mcwidth;


in the text file
&mcwidth=200&



any help would be much appreciated..

Scaling An Object By Cursor Position
I am trying to modify this tutorial "Rotating Menu" (Interaction - Navigation). This is what I have so far:

Code:
//determines the position of the mouse
x = getProperty("../dragControl", _x);
//checks to see if the mouse is in the movie
if (Number(x)<200||Number(x)>200){
//reduces x so that the change in the menu's size is not too drastic
midX = x-(400/2);
//checks to see if the new variable is a negative number
if (Number(midX)<0) {
//if it is then it changes it to positive
midX = -midX;
}
//change the width and length of the menu
setProperty("../nav", _xscale, midX);
setProperty("../nav", _yscale, midX);
//check to see if the menu's width and height are less than 30 or more than 100
if (Number(getProperty("../nav", _xscale))<30) {
setProperty("../nav", _xscale, "30");
setProperty("../nav", _yscale, "30");
}
if (Number(getProperty("../nav", _xscale))>100) {
setProperty("../nav", _xscale, "100");
setProperty("../nav", _yscale, "100");
}
}

The way it is now, when the mouse moves to the horiz. center, the nav get smaller. I want the opposite to happen.

Any help would be appreciated.

[F8] Dynamic Scaling Object Runtime
hello everybody

I am working on a project where we have to resize an object on runtime .ie it will have a bounding box from where user will change its size.but i dont have much idea about it .I tried it with movie clips changing there size with mouse position but what about the bounding box.


Help me out of this
Thanks in advance

Sliding Gallery With Object Scaling
Alright guys. I'm making a sliding gallery that scales the middle picture from 80% to 100% while all the other pictures are 80%.

The problem I have right now is that I can't figure out how to "de-scale" the picture when you press a new one. Right now I just have tween which scales event.currentTarget to 100%, but how do I de-scale all the other objects?

Here's a example if you didn't get what I was trying to explain.
http://richardz.se/test/sliding_icons.swf

All ideas are welcomed!

Thanks!

Fscommand For Fullscreen Without Scaling The Object
Hi,

Greetings to all.

This is regarding fscommand. I need a fulscreen fscommand for a presentation. It just make the fulscreen without scaling the object. The flash file resolution is 750x600.

Is it possible.

Thanks & regards
somaraj

Specific Flash Scaling + SWF Object
Hello,

We're having trouble using the SWFobject ( http://blog.deconcept.com/swfobject/ ), combined with some extra's:
- The flash movie has some specific scaling behavior for the width and a fixed height (see specs below).
- The "active content"-workaround javascript for Internet Explorer (Eolas patent)

Below you can compare: (Note that the grey areas are HTML, the red and green area's are flash)

1) Example of how flash should scale with the page, running the default flash script of Adobe (AC_RunActiveContent.js), without plug-in detection. This works good:
http://www.thats-id.nl/test_flash_100_percent_width/test_working.html

2) Example of our final test with the SWFobject, that doesn't behave how it should. Notice that when scaling the browser smaller then the width of the movie it sticks to the left side of the page!
http://www.thats-id.nl/test_flash_100_percent_width/test_notworking.html

Download all source files (ZIP) >
http://www.thats-id.nl/test_flash_100_percent_width/flash_100_percent_width.zip

Specs of Flash:

- Uses the "expressinstall.as" [of deconcept] in the usual way (script in first movie-frame).

- There are two movieclips that stretch to to 100% to fill up the complete width of the movie. 1) the clip called "vulwit" and 2) the clip called "achtergrond". For various reasons the "achtergrond"-clip needs to be inside flash, instead of in the object-tag background. I think these clips are part of the problem, because flashmovies with basic 100%-scaling behavior behave normally!

specs of Html / Javascripts:

- The object/embed code first calls the javascript for the well-known active content workaround, in this case "embedflash.js".

- We modified that script a bit for reading flashfiles from the database. That's why the file-extension is not used.

- At the bottom of "embedflash.js", the "swfobject.js" is called. See the code beneath the comment "call SWFobject"

- In the object/embed every width value is set to 100%

Looks like the combination of our flash scaling with the SWFobject conflicts.
I hope there is a solution to this problem!

Kind regards,
Jorn

Scale An Object WITHOUT Scaling The Keyline?
I am trying to scale a box object on the state that I've used in different instances to highlight relevant information. The areas are all different sizes, and I'd like to use different instances of the same movie clip with the box object.

The problem is my box object has a 2px keyline around it, and when I scale my movie to fit the various areas to be highlighted, my keyline also scales, which is ruining the look.

Anyone know a way around this?

Gordon

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