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




Stage.broadcastMessage("onResize")



Stage.broadcastMessage("onResize") doesn't seem to work. I have a lot of classes that add new content to the stage at runtime and would like to be able to call all the different onResize functions in various classes that listen for a stage resize so things get positioned correctly. Do I need to do some plumbing or is there a way to tell the Stage to broadcast a message?

Thanks for any help.



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 02-09-2007, 07:29 AM


View Complete Forum Thread with Replies

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

[F8] Stage.onResize...looking For Something Better
I'd like to call a function that positions objects when the Stage is resized...but I want this function to be called only after the user has finished dragging the window (i.e. she has released the mouse button). Any special listener for this?

Stage.onResize?
In ActionScript 2.0 you'd trigger this event like so


Code:
var L:Object = new Object();
L.onResize = function()
{
trace("all your centering code will go here");
}
Stage.addListener(L);
How do you do this with AS 3.0?

I looked in the flash.events package and I can't find anything that has to do with stage.

i also tried looking in flash.events.Event and couldn't find anything in there... please help me out here!

thanks!

Stage - OnResize
hello all...


i have two swfs. One loads the other.
the thing is that i know Stage.onResize works for a swf, as per adobe docs. i want to know that if the swf is loaded into another swf, then resized.. will it fire the onResize event or will it fire only for the main stage/root document ?

Stage OnResize
I have successfully attached four buttons to the stage which all function fine using the following code. The only thing is the content is not re-aligning upon resize. Can someone tell me what I'm doing wrong here? TIA

import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup( Shortcuts, PennerEasing, Fuse );

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

var activeClip:MovieClip;

var stageListener:Object = new Object();
stage.addListener(stageListener);

function positionStuff(): Void {
c_01._x = (Stage.width/2) - 168;
c_01._y = (Stage.height*3)/4;
c_02._x = (Stage.width/2) - 83;
c_02._y = (Stage.height*3)/4;
c_03._x = (Stage.width/2) + 2;
c_03._y = (Stage.height*3)/4;
c_04._x = (Stage.width/2) + 87;
c_04._y = (Stage.height*3)/4;
}

stageListener.onResize = function():Void {
positionStuff();
};

this.attachMovie("clip","c_01", 2, {_alpha:0});
this.attachMovie("clip","c_02", 3, {_alpha:0});
this.attachMovie("clip","c_03", 4, {_alpha:0});
this.attachMovie("clip","c_04", 5, {_alpha:0});

positionStuff();

c_01.alphaTo(100, 2, "linear", 1);
c_02.alphaTo(100, 2, "linear", 1);
c_03.alphaTo(100, 2, "linear", 1);
c_04.alphaTo(100, 2, "linear", 1);

c_01.onRelease = function() {
activeClip.tintTo(0xA4A4A4,1);
c_01.tintTo(0x999900,100,.3);

activeClip = this;
}

c_01.onRollOver = function() {
if (this != activeClip) {
c_01.tintTo(0x333333,100,.3);
}
}

c_01.onRollOut = function() {
if (this != activeClip) {
c_01.tintTo(0xA4A4A4,100,.6);
}
}

c_02.onRelease = function() {
activeClip.tintTo(0xA4A4A4,1);
c_02.tintTo(0x999900,100,.3);

activeClip = this;
}

c_02.onRollOver = function() {
if (this != activeClip) {
c_02.tintTo(0x333333,100,.3);
}
}

c_02.onRollOut = function() {
if (this != activeClip) {
c_02.tintTo(0xA4A4A4,100,.6);
}
}

c_03.onRelease = function() {
activeClip.tintTo(0xA4A4A4,1);
c_03.tintTo(0x999900,100,.3);

activeClip = this;
}

c_03.onRollOver = function() {
if (this != activeClip) {
c_03.tintTo(0x333333,100,.3);
}
}

c_03.onRollOut = function() {
if (this != activeClip) {
c_03.tintTo(0xA4A4A4,100,.6);
}
}

c_04.onRelease = function() {
activeClip.tintTo(0xA4A4A4,1);
c_04.tintTo(0x999900,100,.3);

activeClip = this;
}

c_04.onRollOver = function() {
if (this != activeClip) {
c_04.tintTo(0x333333,100,.3);
}
}

c_04.onRollOut = function() {
if (this != activeClip) {
c_04.tintTo(0xA4A4A4,100,.6);
}
}

Help On Stage.onResize
i have a movieclip that i want to position all the way on the top left corner of the stage and the movie is published a full screen so its all the way on the top left of the edge of the browser and i want it to stay there even if the browser resize... and it is aligh Stage.align="B"..

Stage.onResize
Hi all.

I've a swf of these dimensions: 705 x 810.

On frame 1 on this swf:


ActionScript Code:
// Stage
Stage.align = "T";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
fscommand("fullscreen", "true");
var StageListener:Object = new Object();
StageListener.onResize = function() {
    trace("Stage size is now " + Stage.width + " by " + Stage.height);
};


In the html page there is this code:


ActionScript Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>:. Presslab Records .:</title>
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="centerStage">
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="movie" value="main.swf" />
  <param name="quality" value="high" />
  <param name="scale" value="noscale" />
  <embed src="main.swf" width="100%" height="100%" quality="high" scale="noscale" name="main.swf" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </embed>
</object>
</body>
</html>


If someone is using 1024 x 768 the site is cropped in the bottom because the browser doesn't show the scrollbar on the right to scroll the page.
I think is like this because the content of the page is only flash and there is no html. Then I've tried to change the html code like this:


ActionScript Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>:. Presslab Records .:</title>
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="centerStage">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="movie" value="main.swf" />
        <param name="quality" value="high" />
        <param name="scale" value="noscale" />
        <embed src="main.swf" width="100%" height="100%" quality="high" scale="noscale" name="main.swf" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </embed>
      </object></td>
  </tr>
</table>
</body>
</html>


Nothing changes.

There is a solution to force the browser to show the scrollbar or I'm doing something wrong?

Thx to all

Stage Onresize Tween
attempting to reposition contents of swf on resize of browser window with tween class

Stage.align = "TL";
Stage.scaleMode = "noScale";
stageListener = new Object();
stageListener.onResize = function() {
moveIt();
};
Stage.addListener(stageListener);
moveIt = function () {
dash.onEnterFrame = function() {
this._x += ((Stage.width/2)-this._x)/5;
this._y += ((Stage.height/2)-this._y)/5;
};
};

Stage.onResize Problems
Hey everyone.

Clicky.

Basically, I am using Stage.onResize (after adding a listener to the stage) to position elements.

So, basically:


Code:
stageWidth = 750;
stageHeight = 500;
Stage.scaleMode = "noScale";
var resizeListener:Object = new Object();
resizeListener.onResize = function() {
VpositionElements();
HpositionElements();
mainContentsStuff();
stageDimensions();
};
VpositionElements();
HpositionElements();
mainContentsStuff();
stageDimensions();
I call the functions when the .swf loads. However, it isn't working. Notice that you have to resize your browser to get those functions to start.

Also, you can see that if you resize the stage really quickly, the functions pretty much get screwed up and don't work properly (click somewhere on the main contents and then resize the stage).

Is this a problem with the function in Flash or am I not doing it right?

Thanks

Tween Stage.onResize Objects
I understand how to change a movieclip's coordinates based on the Stage size via stage.onResize, but I've noticed a few sites out there that tween a movieclip after the user releases the corner of the browser:

http://www.gskinner.com/

anyone know how he added that nice little touch?

standard stage.onResize functionality acts more like this:

http://www.tutorio.com/media/flash/liquid-demo.html

Stage.onResize Finished Event?
Hi,

I am currently working on a full flash site - fixed width, centred but with variable height. I have implemented a scrollbar that automatically adjusts to the height of all elements within the site and this scrolls the content fine. The flash file is embedded in html at 100% btw.

My problem comes when I need to scroll the content when the stage is resized. For example, move the scrollbar all the way to the bottom and then enlarge the window, the view area should increase and the page should move downward to reveal more content automatically. I have done this but cannot get it working smoothly enough.

My question is this, I feel it would be very helpful if I had an event which could be triggered when stage resizing stops, this seems a simple request but I am stumped - I think I've stared at it for too long!! How can I achieve a trigger at this event?

Please please help!

Stage.onResize Issue With Matrix
Hey all, this should be really simple:

I have a "bg" class that implements itself as a listener to the Stage to capture onResize events.

so, on resize it executes the following code:

ActionScript Code:
import flash.display.BitmapData;
import flash.geom.Matrix;
 
function onResize() {
var w:Number=Stage.width;
var h:Number=Stage.height;
var mat:Matrix=new Matrix();
var xs:Number=w/fx_bmp.width;
var ys:Number=h/fx_bmp.height;
mat.scale(xs,ys);
var bmp:BitmapData=new BitmapData(w,h,true,0);
bmp.draw(fx_bmp,mat);
fx_mc.attachBitmap(bmp,1);
}


Basically, the class loads a Bitmap image that is 1600x1200 called "fx_bmp" and then when the window is resized is redraws "fx_bmp" using a matrix that scales the 1600x1200 image to match the screen dimensions. Finally, it attaches the new scaled bitmapData object to the existing "fx_mc" movieClip on Stage to display it.

It acts as though I had replaced the bmp.draw(fx_bmp, mat); with something like:
bmp.draw(fx_mc,mat);


Unfortunately, it doesn't work and I can't figure out why?

I'm sure it's something simple, but any advice would be greatly appreciated.

Thanks in advance,
jase

Stage.onResize, Safari & Frames
OK, I think I have found a bug that I am not sure how to get around. I looked around and couldn't find any info on this.

I am using a listener to move a background around on a SWF so that it is always at the bottom left. Well, it works on IE and Firefox, but not on Safari.

The problem seems to be because I am using Frames. If a SWF is in a Frame in Safari, it appears that a resize of the browser window doesn't trigger the Stage listener. If I put the SWF in its own window and not in a frame, it works fine in Safari.

So, my question is, can you control what the Stage listener refers to? Meaning, is there something that triggers a new stage height when a frame is resized?

Hope that makes sense.

Here is the website: My Website

The problem is the menu I have on the left side not being affected by a resize in Safari.

Need To Update Movieclip Width With Stage.onResize()
I am trying to create a function that adjusts the width of movieclips in my component when the stage is resized.

I have created a "Listener" function that sets a global variable equal to the stage's current width when the Stage.onResize event fires. Then in my component, I am using this global variable to determine the width of the movieclips. The problem is that even though the variable has changed, the component does not seem to use the new value.

Here is the relevant code for the component:

Code:
fieldWidth = ((_global.availWidth - this["header"+i+"_cellClip"].dataText._width - 425)/6);


And here is the function that creates the listener for when the stage is resized:

Code:
myListener = new Object();
myListener.onResize = function() {
_global.availWidth = Stage.width;
trace(_global.availWidth);
}
Stage.addListener(myListener);

Draw Gradient Background, Update On Stage.onResize
I'm trying to achieve a smooth gradient background using a gradientFill, and I want this background to respond to browser size changes. So far, I have it working fairly well, but there are a few glitches that appear when resizing the browser window fairly quickly, or reducing it below a certain size.

Currently: http://testing.duncanhall.net/test/flash.html

The function I'm using to draw the gradient is as follows:


ActionScript Code:
function renderBackground():Void {
    xPositioner = (Math.round((Stage.width - 640) / 2));
    yPositioner = (Math.round((Stage.height - 480) / 2));
   
    zeroX = 0 - xPositioner;
    zeroY = 0 - yPositioner;
       
    wSize = Stage.width;
    hSize = Stage.height;
    fillType = "linear";
    colors = [0x444444, 0xCAD8E6];
    alphas = [100, 100];
    ratios = [0, 255];
    matrix = {matrixType:"box", x:0, y:0, w:wSize, h:hSize, r:90/180*Math.PI};
    this.lineStyle(1, 0xFFFFFF, 0);
    this.beginGradientFill(fillType, colors, alphas, ratios, matrix);
    this.moveTo(zeroX, zeroY);
    this.lineTo(wSize, zeroY);
    this.lineTo(wSize, hSize);
    this.lineTo(zeroX, hSize);
    this.lineTo(zeroX, zeroY);
    this.endFill();
}

This is called on initialization of the swf, and also in the onResize method of my Stage listener object.

Can anyone offer any advice on how I might go about perfecting this effect?

Any help would be most appreciated.

Trying To Fill A Box With Lines That Change Size OnResize.Stage
Is that the correct way ??? Ty


Code:

onClipEvent (load) {
boxListener = new Object();
boxListener.onResize = function ()
{
function grid (n , alpha, color){
for (x = 0; x<this.width; x+=n){
lineStyle (1,color,alpha);
moveTo (x,y);
lineTo (x,this.height);
}

}
grid (3,25,0xFFFFFF);
}
this.addListener(boxListener);

updateAfterEvent();
}

Stage Size Same As Screen Resolution Without OnResize Event ?
Is there another way to resize the stage than via the "onResize" event ? I
would like the movie to get the screen resolution when it loads into the
Flash Player (not a hmtl page) and adapt to the size of the screen. (for a
screensaver).. thank's

OnResize / Stage.width Not Read On Initial Load With Firefox
I have just started to develop a website and very quickly realised that Mozilla doesnt seem to read any Stage.width or onResize parameters on initial load of movie. If i manually resize the browser window it will then work but this is no good for me as I need the width to be calculated onLoad thus:-

onClipEvent(load)
{
this._width = Stage.width + origX;
this._x = 0 - origX;
}

or

Stage.scaleMode = "noScale"
var myListener:Object = new Object();
myListener.onResize = function () {
gradient_mc._width = Stage.width + origX;
gradient_mc._x = 0 - origX;
}
Stage.addListener(myListener);

Looking around online I have found some thread relating to DOCTYPE being XHTML on Mozilla but I do not want to use an old doc type.

Any ideas or feedback on this would be great.

Add Listener And BroadcastMessage
Im back to learning flash after a year off doing css xhtml sites, forgot how frustrating and satisfying it can be.

im creating a drop down menu, Ive used robert penners easing equation for the motion. Then I noticed that he had used
Code:
this.broadcastMessage("clipIsGone", this._parent);
//Which I traced to make sure of target
trace("broadcast "+ this._parent._name)
So makes sense to add a listener to the mcs which move, however im having no joy, or ive just not understood listeners correctly, ive tried
Code:
_root.myClip["menuItem"+s].addListener(_root.blank)
_root.blank.clipIsGone = function(){
trace("gone");
}
//also tried
function clipIsGone(){
trace("gone");
}
any ideas?

About BroadcastMessage Problem?
Hi all, I have the code following, but it does not do trace("ClassBegin").
Anyone tell my the problem? Thanks in advance!

King = {};
ASBroadcaster.initialize(King);
function aStudent(){

}
aStudent.prototype = new MovieClip();
aStudent.ClassBegin = function()
{
trace('ClassBegin');
}
aStudent.prototype.ClassEnd = function()
{
trace('ClassEnd');
}
Object.registerClass("aStudent",aStudent);
this.attachMovie("aStudent", "s", i);
King.addListener(_root["s"]);

King.broadcastMessage("ClassBegin");

--------
MT

BroadcastMessage From Class
For the Flash application I'm developing, I would like to be able to make custom listeners. I've got a class and want to broadcast an event from within that class. Then I would like to let objects outside of that class listen for these events that the instances of the class will broadcast.
First of all, that should be possible right?

Then second, how do we do this in Flash? If I try to use broadcastMessage, the compiler complains: There is no method with the name 'broadCastMessage'.

The problem is that I would like to let my class broadcast an event, not an object I create at runtime like in the examples.

Warning: BroadcastMessage Is Not A Function
Targeting Player 8/ AS 2 - this project is generating continual warnings (up to the limit):

Warning: broadcastMessage is not a function

"broadcastMessage" is not anywhere in my code (actually someone else's that I've been asked to modify)
It only appears when I run the SWF in a browser, not when I preview within Flash
It seems to relate somehow to the use of Tween (see code below), but why why why?








Attach Code

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

stop();

//xml loaders

var homeXML:XML = new XML();
homeXML.ignoreWhite = true;
homeXML.onLoad = function(success:Boolean):Void {
if (success) {
//_root.gotoAndStop("init");
trace("loaded");
} else {
trace("xml failed");
}
};


var featureXML:XML = new XML();
featureXML.ignoreWhite = true;
featureXML.onLoad = function(success:Boolean):Void {
if (success) {
homeXML.load("xml/info.xml");
} else {
trace("featureXML failed");
}
};
featureXML.load("xml/features.xml");


var stageTween:Tween = new Tween(stage_mc, "_alpha", Regular.easeIn, 0, 100, 20, false);
trace(stageTween);

AS2: "no Method With The Name 'broadcastMessage'"
Why does this external class file not compile? I want it to be able to broadcast events to listeners but using "AsBroadcaster.initialize(this);" in the constructor does not seem to be enough. Any suggestions?


ActionScript Code:
class QueLoader{    private var mcLoader:MovieClipLoader;    private var qlListener:Object;    private var qlItemsLoadingArray:Array;    private var qlTargetMCArray:Array;    private var qlCurrentLoading:Number;        function QueLoader(){        qlCurrentLoading = 0;        qlItemsLoadingArray = new Array();        qlTargetMCArray = new Array();        mcLoader = new MovieClipLoader();                qlListener = new Object();        //Do when Item begins loading        qlListener.onLoadStart = function(target:MovieClip){                    };        //Do when item loading progresses        qlListener.onLoadProgress = function(target:MovieClip, bLoaded:Number, bTotal:Number){                    };        //Do when item loading complete        qlListener.onLoadComplete = function(target:MovieClip, httpStatus:Number){                    };        //Do when item loading error        qlListener.onLoadError = function(target:MovieClip, errorCode:Number, httpStatus:Number){                    };        mcLoader.addListener(qlListener);                //This que should be able to broadcast events        AsBroadcaster.initialize(this);     }            public function addToQue(item){            }        public function removeFromQue(item){        //If que is now empty        this.broadcastMessage("queEmpty");    }        public function pauseQue(item){        this.broadcastMessage("quePaused");    }        public function resumeQue(item){        this.broadcastMessage("queResumed");    }        public function getTotalBytesInQue(){    }}

OnResize
Sorry for asking a question that has been addressed in many ways....but im going mad. Ive used Uramis script for the resize handler in many combinations, with a variety of results...but not what is needed.

The stage has a cylinder gradient fill: I want this to stretch to fill the browser completely according to the browser resize both horizontals and verticals (so that distorts and has no border). Ive gone through the 100% publish, however it keeps it ratio.

I then want a movie clip the remain central to the browser. (ive created a mc and given it an instance name that refers to the script)

If i want to load external swf that is aligned with this mc (depending on the menu choice), how do i ensure that it is placed in the required position, do i place an empty mc within the original mc? If i do this, will the resized browser mess the position of the external swf place in the empty mc?

The reason I want to construct the project completely in flash, rather than using a css background in html, is that I want to preserve the background behind the flash movie. I know that i may have the brains and endurance of a dead dog, but could someone give me a step by step induction


Many many thanks in advance

OnResize?
Hey, i have a bar that i'm using for a menu thats 40 pixels high, and i have an event handler for the Stage.onResize event which reads something like:

Stage.onResize = function(){
...
menuBar_mc._y = Stage.height-40;
}

i thought this would work but it doesnt, i've also tried adding the difference of the old height and the new height and this didnt work either....

can someone help me?

cheers,
Jamey

Please Help With OnResize
Hey!

I need your help!

I've got a website whick looks like a band. The band should exactly start at the left and end at the right. So I need a code in my swf which resizes the swf corresponding to the size of the browser window.
I heard I can do it with someting called "onResize". I searched on ultrashock and google but didn't find anything I could need.

Could you please help me with a tutorial or some code?

It's very important!

Thanks!
Max

Onresize Listeners
Hey...i have movie clips loaded using Listeners. i.e.

Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.addListener(this);
this.onResize = function() {
menu1._x = Stage.width*(0/100);
menu1._y = Stage.height*(50/100);
};
this.onResize();

What i would like to introduce is another movie clip that will scale according to the browser (however without distortion...maybe 90% of browser width for example...)

...how can i do this is the initial script contains 'noscale'.....

many thanks in advance

OnResize Question....
Hi All,

I need some help with an onResize issue that I can't working and I don't understand why!?

I have an fla that is basically on one frame in the timeline - but on layers to accommodate elements and the AS for the different bits n bobs.

The problem is that I have some scripting that controls the movieclip named anchor to rotate around a radius that is set from the centre of the screen - this works fine and the radius is set from the central point on the screen - untill - resize! at which point it throws a wobbler - and the radius remains at the original point.

For the life of me I can not get the radius to recognise when the stage is resized!

The script that controls the radius/rotation and associated gubbins is:

PHP Code:



var mouseRotation = true;    // t/f set mouse to rotate around obstaclevar radius = 300;var centerX = Stage.width/2;var centerY = Stage.height/2;this.init = function(){        // Hide original mouse    Mouse.hide();        // attach mouse arrow clip to stage    var clip = this.attachMovie("anchor","a1",1)        // actiavte mouse rotation around obstaclle    mouseRotation = true;        // Assign rendering for banenr    clip.onEnterFrame = renderMouse;    }// render mouse positionthis.renderMouse = function(){        // ste obstacle radius to slider value    obstacle_mc._xscale = obstacle_mc._yscale = radius/460;        // Place arrow at mouse position    this._x = _xmouse;    this._y = _ymouse;        this._rotation = 0;        // Rotate arrow around obstacle if mouseRotation is set to true    if (mouseRotation) {                // Get properties        var X = (this._x - centerX);        var Y = (this._y - centerY);        var dist = Math.sqrt(X*X+Y*Y);                // get distance from center        var rad =  (avoidObject()*Math.PI)/180;        // set object angle in radians                // if inside obstacle radius rotate around in circle        if(dist < radius) {                        dist = radius;                        // set to new position            this._x = centerX + dist * Math.cos(rad);            this._y = centerY + dist * Math.sin(rad);        }                // set rotation         this._rotation = avoidObject()-100;    }}//this.avoidObject = function() {        // FIRST COMPUTE THE DISTANCES FROM THE MOVIECLIP    var deltaX = _xmouse-centerX;    var deltaY = _ymouse-centerY;    // NEXT USE THESE DISTANCES TO CALCULATE THE ANGLE BETWEEN THEM:    var angle = Math.atan2(deltaY, deltaX);    // FINALLY CONVERT THE ANGLE FROM RADIANS TO DEGREES AND THEN RETURN THE RESULT:    angle *= 180/Math.PI;        return angle;}this._btn.onRelease = function(){    mouseRotation = !mouseRotation;}init();




I do have a stage listener set up for onResize on a different layer and thought that I would be able to add the anchor to this onresize function - but that doesn't do it!
Here is my onResize function:

PHP Code:



Stage.align = "TL";Stage.scaleMode = "noscale";Stage.addListener( this );function onResize(){        myMENU._x = 0;    myMENU._y = Math.floor(0);    myMENU.menuCONTENT.bgMENU._width = Math.floor(Stage.width);    myMENU.menuCONTENT.RBUTTON._x = Math.floor(Stage.width);        CENTERpages._x = Stage.width / 2 - CENTERpages._width / 2;    CENTERpages._y = Stage.height / 2 - CENTERpages._height / 2;    world._x = Stage.width / 2 - world._width / 2;    world._y = Stage.height / 2 - world._height / 2;    anchor._x = Stage.width / 2 - anchor._width / 2;    anchor._y = Stage.height / 2 - anchor._height / 2;    }onResize();




Now I don't know if I should be trying to use the function above or to re-write the rotation/radius script that I posted at the top of this thread?

Anyone tell me where I should be looking at or why my attempts are missing the target and the centre point of the radius is not recognising onResize?!?!?!!

Please?

AS3 OnResize Question...
Hi,

Just getting to grips with as3 and have hit a stumbling block!
I have an fla that has four mc's - that together with this script create a carousel - with one mc acting as the hub and the other three rotating around it .

PHP Code:




import idv.cjcat.display.carousel.Carousel;
import idv.cjcat.display.carousel.Pony;

var balls:Array = [ball1_mc, ball2_mc, ball3_mc];
var carousel:Carousel = new Carousel;
//centers and radii for the (x, y) coordinate
carousel.centerX = stage.stageWidth/2;
carousel.radiusX = 150;
carousel.centerY = stage.stageHeight/2;
carousel.radiusY = -50;

//center and radius for the scaleX and scaleY property
carousel.centerS = 1;
carousel.radiusS = 0.5;

carousel.axis = axis_mc;

for (var i:int = 0; i < balls.length; i++) {
    carousel.add(new Pony(balls[i], Math.PI * 2 / 3 * i /*this is the 'phase' of the Pony around the carousel*/));
}

addChild(carousel);
addEventListener(Event.ENTER_FRAME, rotate);
function rotate(e:Event):void {
    carousel.phase = getTimer() / 500;
    carousel.render();
}
addEventListener(Event.ENTER_FRAME, tweak);
function tweak(e:Event):void {
    carousel.phase = mouseX / -100;
    carousel.render();
}







This all works great until I complicate matters by trying to integrate some liquid layout type stuff - by using this script:

PHP Code:




import flash.display.*;

//set stage position
stage.align = StageAlign.TOP_LEFT;
//do not let any of the stage scale
stage.scaleMode = StageScaleMode.NO_SCALE;

//add stage resize listener,
//this is called when the browser or flash movie is resized
this.stage.addEventListener(Event.RESIZE, resizeHandler);

//create trigger that is fired when resize is triggered
function resizeHandler(event:Event):void {     
position();
}

//call resize function at start of movie
//this way everything starts in the right place
position();

//this is the function contains all your code
//you can add your own as long as there
//is a movie clip on the stage that you named correclty
function position(){
middleClip.x = stage.stageWidth/2;
middleClip.y = stage.stageHeight/2;
axis_mc.x = stage.stageWidth/2;
axis_mc.y = stage.stageHeight/2;
ball1_mc.x = stage.stageWidth/2;
ball1_mc.y = stage.stageHeight/2;
ball2_mc.x = stage.stageWidth/2;
ball2_mc.y = stage.stageHeight/2;
ball3_mc.x = stage.stageWidth/2;
ball3_mc.y = stage.stageHeight/2;
topClip.width = stage.stageWidth;
topClip.y = 0;
topClip.x = 0;
botClip.width = stage.stageWidth;
botClip.x = 0;
botClip.y = stage.stageHeight - topClip.height;
}







This works great and positions 'all' the elements on the stage as they should be. But, but, but when I resize the stage everything moves in relation apart from the three mc's that rotate (ball1_mc, ball2_mc, ball3_mc) which simply stay where are?

What am I doing wrong or not doing at all that makes this happen? I have going at this most of the afternoon to no avail

I have attached the folder as a .zip file if anyone needs it to see what I mean?

Really grateful to anyone that can offer me some experience in the field of the workings of AS3

Here's hoping!
***crosses fingers***

OnResize Question?
Hi,

Just getting to grips with as3 and have hit a stumbling block!
I have an fla that has four mc's - that together with this script create a carousel - with one mc acting as the hub and the other three rotating around it .

PHP Code:



import idv.cjcat.display.carousel.Carousel;
import idv.cjcat.display.carousel.Pony;

var balls:Array = [ball1_mc, ball2_mc, ball3_mc];
var carousel:Carousel = new Carousel;
//centers and radii for the (x, y) coordinate
carousel.centerX = stage.stageWidth/2;
carousel.radiusX = 150;
carousel.centerY = stage.stageHeight/2;
carousel.radiusY = -50;

//center and radius for the scaleX and scaleY property
carousel.centerS = 1;
carousel.radiusS = 0.5;

carousel.axis = axis_mc;

for (var i:int = 0; i < balls.length; i++) {
    carousel.add(new Pony(balls[i], Math.PI * 2 / 3 * i /*this is the 'phase' of the Pony around the carousel*/));
}

addChild(carousel);
addEventListener(Event.ENTER_FRAME, rotate);
function rotate(e:Event):void {
    carousel.phase = getTimer() / 500;
    carousel.render();
}
addEventListener(Event.ENTER_FRAME, tweak);
function tweak(e:Event):void {
    carousel.phase = mouseX / -100;
    carousel.render();





This all works great until I complicate matters by trying to integrate some liquid layout type stuff - by using this script:

PHP Code:



import flash.display.*;

//set stage position
stage.align = StageAlign.TOP_LEFT;
//do not let any of the stage scale
stage.scaleMode = StageScaleMode.NO_SCALE;

//add stage resize listener, 
//this is called when the browser or flash movie is resized
this.stage.addEventListener(Event.RESIZE, resizeHandler); 

//create trigger that is fired when resize is triggered
function resizeHandler(event:Event):void {     
position();
}

//call resize function at start of movie
//this way everything starts in the right place
position();

//this is the function contains all your code
//you can add your own as long as there 
//is a movie clip on the stage that you named correclty
function position(){
middleClip.x = stage.stageWidth/2;
middleClip.y = stage.stageHeight/2;
axis_mc.x = stage.stageWidth/2;
axis_mc.y = stage.stageHeight/2;
ball1_mc.x = stage.stageWidth/2;
ball1_mc.y = stage.stageHeight/2;
ball2_mc.x = stage.stageWidth/2;
ball2_mc.y = stage.stageHeight/2;
ball3_mc.x = stage.stageWidth/2;
ball3_mc.y = stage.stageHeight/2;
topClip.width = stage.stageWidth;
topClip.y = 0;
topClip.x = 0;
botClip.width = stage.stageWidth;
botClip.x = 0;
botClip.y = stage.stageHeight - topClip.height;





This works great and positions 'all' the elements on the stage as they should be. But, but, but when I resize the stage everything moves in relation apart from the three mc's that rotate (ball1_mc, ball2_mc, ball3_mc) which simply stay where are?

What am I doing wrong or not doing at all that makes this happen? I have going at this most of the afternoon to no avail

I have attached the folder as a .zip file if anyone needs it to see what I mean?

Really grateful to anyone that can offer me some experience in the field of the workings of AS3

Here's hoping!
***crosses fingers***

OnResize And Tweener
I have my stage to listen to the RESIZE event and position elements accordingly - this is fine. I also have a movieclip that responds to Tweener (to move and play the movieclip at the same time). At this point, the movieclip blips or jumps (almost like the stage resize event is still working) and then tweens.

My question is, could the resize event affect the Tweener, causing some weird convulsion?

Here's my resize function:








Attach Code

** Inside document class **

public function DocClass()
{
addChild(mc); //adding multiple mc's to the stage

reSize();

stage.addEventListener(Event.ADDED, onResize);
stage.addEventListener(Event.RESIZE,onResize);
stage.align = "TL";
stage.scaleMode = "noScale";
}

public function reSize()
{
mc.x = stage.stageWidth/2; //move elements accordingly
}

public function onResize(e:Event)
{
reSize();
}

OnResize With Easing
Hello peeps,

I would like my movie clip to resize my 'content' to the stage with easing but am a little unsure where to go from here. Could anybody pls offer some advice or point me in the right dircetion please.
Hrere is an example http://www.nttdata.co.jp/en/index.html
Here is my current code

ActionScript Code:
// Do not scale my movieStage.scaleMode = "noScale";// Align the stage to the top rightStage.align = "TL";// define a function to alignobjects on stage resizealignSite = function () {// Align the background the middlewith (background) {_y = Stage.height/2;_x = Stage.width/2;}with (content) {_y = Stage.height/2;_x = Stage.width/2;}};resizer = new Object ();resizer.onResize = function () {alignSite ();};Stage.addListener (resizer);alignSite ();
thanks
mart/.

Listener.onResize
Within flash 8 i'm working the folowing website:
http://www.dri360.com. The centered MC size changes when clicked a button.
I published the movie as a 100% x 100% with a noscale option.

My problem is the next. I want to add a movieclip in my main timeline wich must go automatically to the left of the users screen. if you got 1024x 768 and even when someone got a nice 30" screen from with a resolution from 2560x1600. yesterday i posted a thread and i've got the next code wich did not work in my movie. I don't know if it's my fault.
the next code i placed in my main timeline:

ActionScript Code:
listener.onResize = function (){    menuMc._x = menuMc._y = 0;    menuMc._height = Stage.height;};

Ofcourse
I tried several things today but nothing works. i tried different publish settings. the listener option was new for me and i tried to find out what it does.
I think there is my problem..
do i need to add a line like addListener? or do i need to name the function?
DOes someone can help me out so i can make a menu in the left of the screen without scaling and the movie centered.
If someone knows where i website to learn this type of actionscript.

kind regards Jos Koomen

OnResize Question
I'm trying to figure out how to get my logo to stay at the bottom right of the page all the time. I used Stage.align and onResize but the problem is that my logo ony aligns when you go to resize the window, and it "jumps" into place. I want it to pop up in the bottom right and then stay there, regardless of the window size. You can view it at This is my code:


Code:
stop()
Stage.align = "BL";
Stage.scaleMode = "noScale";
stop ();
logomc._x = Stage.width - logomc._width;
tower._y = Stage.height - tower._height;


sizeListener = new Object();
sizeListener.onResize = function() {
logomc._x = Stage.width - logomc._width;
tower._y = Stage.height - tower._height;
};
Stage.addListener(sizeListener);


Thank you for your help!

OnResize CPU Intensive, Please Help :'(
Hi all, I have done a search on this topic, but couldn't find the right solution for me.

I've made a flash file which contains the following:backgroundMC (consist of vector art made in illustrator and imported)
holderMC (loads an external swf which contains my game)
I want the background to scale when the Stage get resized so I used the following code as everyone else does:
ActionScript Code:
Stage.scaleMode = "noScale";
Stage.align = "LT";

function resizeBG() {
backgroundMC._width = Stage.width;
backgroundMC._height = Stage.height;
backgroundMC._x = Math.round(Stage.width / 2);
backgroundMC._y = Math.round(Stage.height / 2);
}

var stageL:Object = new Object();

stageL.onResize = function(){
resizeBG();
holderMC._x = Math.round((Stage.width / 2)-360);
holderMC._y = Math.round((Stage.height / 2)-150);
}

Stage.addListener(stageL);




This works perfectly fine for me, but it has one glitch....
The Stage.addListener keeps on listening for the Stage to resize, but this seems to cause my game.swf to run real slow :'(

If I use
ActionScript Code:
Stage.removeListener(stageL);



it should be resolved, but.....

Then if I resize my window the backgroundMC doesn't, because the listener isn't active anymore... Is there a way to resolve this?

So to make a long story short:
I want my Stage to resize the backgroundMC, but without causing my game.swf (which is dynamicly loaded) to run slow...

Thanks in advance

MyListener.onResize
I could do with some help on Stage.addListener. I’m a bit lost at the minute

Right I have an Movieclip named studio_mc sitting on stage and I have 2 buttons, 1 button slides the studio_mc to the centre of the stage using

Studio_mc.ySlideTo ( Stage.height/2,1,”easeOutExpo”)

And the other button slides the studio_mc off stage using

Studio_mc.ySlideTo ( Stage.height-250,1,”easeOutExpo”)

Both _x positions are also set up for centre stage too, no problems there and everything works fine and the movieclip moves on and off stage depending on what button is pressed. What I have a problem with is the myListener. onResize function.

What do I have to set up for the Stage listener to reset the position of the studio_mc to Stage.height/2 whilst its on stage and to Stage.height-250 if its of stage when the browser is resized, been driving me nuts

I can’t use this


var myListener:Object = new Object ();
myListener.onResize = function(){
studio_mc.ySlideTo(Stage.height/2,1,”easeOutExpo”)
};
Stage.addListener(myListener);

as the studio_mc might be off stage when the browser is resized. Any ideas would be really helpful as I’m I bit of an AS numpty.

Problem With OnResize
Hey

I have two questions actually.

First: I have background that scales to the window size and content loaded over it that also scales, but when I click on the maximize button on the window my content does not scale along with the background...don't know why.

Second: I finally found a cool image gallery app at www.flashOtaku.com. the only thing is that I want to load separate xml files on separate buttons but I can't seem to get that right either...my class will perhaps give somebody smarter than me a better idea of what is goin on...

thanx for any help....you can check the site here to see what happens with the class as it is now. www.crystal-concept.com Please be patient, I'm still working on a preloader

Thanx again



Code:
package
{
import flash.display.DisplayObject;
import flash.display.SpreadMethod;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.ContextMenuEvent;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.events.TimerEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.ui.Mouse;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import caurina.transitions.Tweener;
import com.flashotaku.slideshow.Slideshow;
import com.flashotaku.thumbnailscroller.ThumbnailScroller;
import com.flashotaku.thumbnailscroller.events.ThumbnailEvent;
import com.flashotaku.slideshow.events.SlideshowEvent;
import flash.utils.Timer;
import gs.TweenMax;

public class main extends Sprite
{
public static var origW:Number = 1024 //original stage width
public static var origH:Number = 768 //original stage height

//graphic resources
private var bg:Sprite;
private var cont:Sprite;
private var art:Sprite;
private var photo:Sprite;
private var project:Sprite;


//constructor
public function main ()
{
//Tel the player not to scale the assets
stage.scaleMode = StageScaleMode.NO_SCALE;

//Tell the player to put co-ords 0,0 to the top left corner
stage.align = StageAlign.TOP_LEFT;

//Listen for resize events
stage.addEventListener(Event.RESIZE, onResize);

//Create and add body resource to the display list
bg = new bg_mc();
addChild(bg);

cont = new content();
addChild(cont);

art = new art_mc();
cont.addChild(art);
art.x = 94.2;
art.y = 512.5;

photo = new photo_mc();
cont.addChild(photo);
photo.x = 136.1;
photo.y = 517.9;

project = new project_mc();
cont.addChild(project);
project.x = 150;
project.y = 535;


//Size everything after creation to insure the app is drawn
//properly the first time it is seen prior to any user initiated
//resizing
onResize(null);

art.addEventListener(MouseEvent.CLICK, ClickListener)
photo.addEventListener(MouseEvent.CLICK, ClickListener1)
project.addEventListener(MouseEvent.CLICK, ClickListener2)



//set button properties
art.buttonMode = true;
art.useHandCursor = true;
photo.buttonMode = true;
photo.useHandCursor = true;
project.buttonMode = true;
project.useHandCursor = true;

var box:Sprite = new Sprite;
var imageBox:Sprite = new Sprite;
var mySlideshow:Slideshow;
var myScroller:ThumbnailScroller;
var init:Boolean;

//whatclick function
function whatClick(event:MouseEvent):void
{
if (event.currentTarget == art)
{
// return "images.xml";
myScroller.xmlPath = "thumbnails.xml";
trace("art clicked");
}
else if (event.currentTarget == photo)
{
// return "images1.xml";
myScroller.xmlPath = "thumbnails1.xml";
trace("photo clicked");
}
else if (event.currentTarget == project)
{
// return "images2.xml";
myScroller.xmlPath = "thumbnails2.xml";
trace("project clicked");
}
}

art.addEventListener(MouseEvent.CLICK, whatClick);
photo.addEventListener(MouseEvent.CLICK, whatClick);
project.addEventListener(MouseEvent.CLICK, whatClick);


//gallery functions
function loadGallery()
{
mySlideshow = new Slideshow();
mySlideshow.xmlPath = "images.xml";
mySlideshow.autoLoad = false;
mySlideshow.setSize(500, 420);
mySlideshow.x = 476.5;
mySlideshow.y = 27.5;
mySlideshow.setBorder = false;
mySlideshow.preloaderType = "circular";
mySlideshow.transitionEffect = "fade";
}

function loadThumb()
{
myScroller = new ThumbnailScroller();
cont.addChild(myScroller);
myScroller.xmlPath = "thumbnails.xml";
myScroller.setSize(920, 70);
myScroller.x = 50;
myScroller.y = 650;
myScroller.setBorder = true;
myScroller.borderThickness = 2;
myScroller.easingType = "Back";
myScroller.easingMethod = "easeInOut";
myScroller.moveAmount = 100;
myScroller.mouseMove = true;
myScroller.name = "myScroller";
myScroller.addEventListener(ThumbnailEvent.CLICK, clickHandler);
myScroller.addEventListener(ThumbnailEvent.THUMB_INIT, addBlur);
myScroller.addEventListener(ThumbnailEvent.MOUSE_OVER, rollOverBlur);
myScroller.addEventListener(ThumbnailEvent.MOUSE_OUT, rollOutBlur);
}

//thumbnail functions
function clickHandler(event:ThumbnailEvent):void
{
if(!init)
{
init = true;
cont.addChild(mySlideshow);
mySlideshow.loadImage(event.item.id);
trace(event.item.id);
}
mySlideshow.loadImage(event.item.id);

}
function addBlur(event:ThumbnailEvent)
{
TweenMax.to(event.item.child, 0.5, {alpha:1});
}
function rollOverBlur(event:ThumbnailEvent)
{
TweenMax.to(event.item.child, 0.5, {alpha:0.1});
}
function rollOutBlur(event:ThumbnailEvent)
{
TweenMax.to(event.item.child, 0.5, {alpha:1});
}


//delet child function
function deleteChild():void
{
cont.removeChild(myScroller);
trace("trying to remove child");

if (Boolean(cont.getChildByName('myScroller')))
{
trace("child removed");
}
else
{
trace("child not removed");
}
}


//tween functions
function tweenBoxIn():void
{
TweenMax.multiSequence
([
{ target:box, time:0.2, y:625 },
{ target:box, time:0.5, scaleY:12 },
{ target:box, time:1, x:35, scaleX:95, onComplete:loadThumb }
]);
}
function tweenIBoxIn():void
{
TweenMax.multiSequence
([
{ target:imageBox, time:0.5, x:466 },
{ target:imageBox, time:0.1, alpha:0.8 },
{ target:imageBox, time:1, scaleX:52 },
{ target:imageBox, time:1, y:15, scaleY:44.4, onComplete:loadGallery }
]);
}

function tweenBoxAgain():void
{
TweenMax.multiSequence
([
{ target:myScroller, time:1, alpha:0 },
{ target:myScroller, onComplete:deleteChild },
{ target:box, time:0.5, y:860 },
{ target:box, time:1, y:625 },
{ target:box, onComplete:loadThumb }
]);
}


//Check ClickListener
function ClickListener(event:MouseEvent):void
{
art.mouseEnabled = false;
photo.mouseEnabled = true;
project.mouseEnabled = true;
trace("button clicked:" + event.currentTarget);

if (Boolean(cont.getChildByName('box')))
{
trace("box found");
tweenBoxAgain();
}
else
{
trace("no boxes found");
box = new Sprite();
box.graphics.lineStyle(2, 0xffffff, 0.5, false, "none");
box.graphics.beginFill(0x000000, 0.5);
box.graphics.drawRect(0, 0, 10, 10);
box.graphics.endFill();
cont.addChild(box);
box.name = "box";
trace("new box drawn");
imageBox = new Sprite();
imageBox.graphics.lineStyle(2, 0xffffff, 0.5, false, "none");
imageBox.graphics.beginFill(0x000000, 0.5);
imageBox.graphics.drawRect(0, 0, 10, 10);
imageBox.graphics.endFill();
cont.addChild(imageBox);
tweenBoxIn();
tweenIBoxIn();
trace("new imageBox drawn");

}

}

//Check ClickListener1
function ClickListener1(event:MouseEvent):void
{
art.mouseEnabled = true;
photo.mouseEnabled = false;
project.mouseEnabled = true;
trace("button clicked:" + event.currentTarget);

if (Boolean(cont.getChildByName('box')))
{
trace("box found");
tweenBoxAgain();
}
else
{
trace("no boxes found");
box = new Sprite();
box.graphics.lineStyle(2, 0xffffff, 0.5, false, "none");
box.graphics.beginFill(0x000000, 0.5);
box.graphics.drawRect(0, 0, 10, 10);
box.graphics.endFill();
cont.addChild(box);
box.name = "box";
trace("new box drawn");
imageBox = new Sprite();
imageBox.graphics.lineStyle(2, 0xffffff, 0.5, false, "none");
imageBox.graphics.beginFill(0x000000, 0.5);
imageBox.graphics.drawRect(0, 0, 10, 10);
imageBox.graphics.endFill();
cont.addChild(imageBox);
tweenBoxIn();
tweenIBoxIn();
trace("new imageBox drawn");
}

}

//Check ClickListener2
function ClickListener2(event:MouseEvent):void
{
art.mouseEnabled = true;
photo.mouseEnabled = true;
project.mouseEnabled = false;
trace("button clicked:" + event.currentTarget);

if (Boolean(cont.getChildByName('box')))
{
trace("box found");
tweenBoxAgain();
}
else
{
trace("no boxes found");
box = new Sprite();
box.graphics.lineStyle(2, 0xffffff, 0.5, false, "none");
box.graphics.beginFill(0x000000, 0.5);
box.graphics.drawRect(0, 0, 10, 10);
box.graphics.endFill();
cont.addChild(box);
box.name = "box";
trace("new box drawn");
imageBox = new Sprite();
imageBox.graphics.lineStyle(2, 0xffffff, 0.5, false, "none");
imageBox.graphics.beginFill(0x000000, 0.5);
imageBox.graphics.drawRect(0, 0, 10, 10);
imageBox.graphics.endFill();
cont.addChild(imageBox);
tweenBoxIn();
tweenIBoxIn();
trace("new imageBox drawn");
}

}
}
//listening for stage resize
public function onResize(event:Event):void
{
//get the new stage height
var sw:Number = stage.stageWidth;
var sh:Number = stage.stageHeight;

//then update the children with this new size
bg.height = sh;
bg.width = sw;
cont.height = sh;
cont.width = sw;
}

}
}

OnResize And New Tab In Firefox
Hi guys,

I have a flash site that uses onResize function to relocate elements. It works well when I resize window in both IE and Firefox. But it doesn't work when I open the second tab in Firefox (switching from non-tab to tab mode).

I've used this code in HTML file to detect onresize event:
<body onResize="alert('resize');">
It alert me when I resize window or when I press ctrl+F, but nothing happened with new tab.

IE7 always show tab mode, so it never has this problem.

Plz help!
Thanks so much!

OnResize Function
I am using the following code.


ActionScript Code:
var stageListener:Object = new Object();
stageListener.onResize = function() {
    stageResize();
}
Stage.addListener(stageListener);


I stageResize(); calls a function that will slide the appropriate objects....

What I need, is to only call the stageResize() function once the user has finished resizing the stage.... I would like to have it so that it waits 0.5 seconds after the last resize before calling the function.... can anyone help me?

As it is right now, the function is being called with each few pixels of resizing. Please help! Thanks.

OnResize = MyFunction()?
Hi,

This works:

ActionScript Code:
myListener.onResize = function() {
    myFunction();
}


But isn't it redundant? I am very anal about keeping my code clean and have tried other combinations. I just want to trigger a predefined function 'myFunction()' with the onResize event.

Am I missing something?

Thanks.

MovieClip.onResize
Any ideas on implementing MovieClip.onResize?

Anyone Know Why This Would Happen OnResize?
here is my resize function:
Code:

onResize();
function onResize() {
  grunge._x = Stage.width - grunge._width;
   main._x = Stage.width - main._width;
   main._y = Stage.height-300;
   footer._xscale = Stage.width;
   footer._y = Stage.height - footer._height;
   footerIcons._x = Stage.width - footerIcons._width;
   footerIcons._y = Stage.height - footerIcons._height;
   trace(main._width);
};


The box is suppose to be aligned to the right side which it is initially, but when I resize the window it gets all screwed up..here is my output window from that trace width:
1000.75
1000.75
1329.95
1329.95
--------

1000 is the correct size and when I go to resize the width jumps to 329 for some odd reason. you can see it at http://blindedblack.airboxstudios.com

OnResize Function PROBELM
Hi I really hope someone can help. I have a movie which has a background which scales full size and three other mc which stay 100%. The code works well but I want to be able to move the mc's up and down the screen...occassionally out of screen.

Any ideas on how I can do this???

code:

function mainInit() {
// Set alignment and scale to allow onResize to work.
Stage.align = "LT";
Stage.scaleMode = "noScale";

titleClip.onResize = function () {
this._x = Stage.width/2;
this._y = Stage.height/2;
}
grad.onResize = function () {
this._x = Stage.width/2;
this._y = Stage.height/2;
this._width = Stage.width;
this._height = Stage.height;
}
colour.onResize = function () {
this._x = Stage.width/2;
this._y = Stage.height/2;
this._width = Stage.width;
this._height = Stage.height;
}
// Register titleClip to be notified when movie is resized.
Stage.addListener(titleClip);
Stage.addListener(grad);
Stage.addListener(colour);
// Set initial position of title clip.
this.titleClip.onResize();
this.grad.onResize();
this.colour.onResize();
}
mainInit(); // Calling centering function

plenty of thanks in advance!

Font - Effected By OnResize
I have the code below to reposition movie clips according to the browser....however i ve just noticed that the pixel fonts (depending on where the browser is moved) can be either really sharp or a blurred as a moving train)


Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.addListener(this);
this.onResize = function() {
menu1._x = Stage.width*(0/100);
menu1._y = Stage.height*(50/100);
menu2._x = Stage.width*(49/100);
menu2._y = Stage.height*(40/100);
menu3._x = Stage.width*(0/100);
menu3._y = Stage.height*(100/100);
eqholder._x = Stage.width*(49/100);
eqholder._y = Stage.height*(40/100);
menu5._x = Stage.width*(50/100);
menu5._y = Stage.height*(99/100);
};
this.onResize();



If anyone could help me out on this i'd really appreciate it

many thanks in advance

How To Stop OnResize When MCs Collide
How would I go about stopping the onResize function when the two MCs collide.
heres my example page http://www.boogiestick.com/flash/

heres my code so far


Code:
Stage.scaleMode = "noScale";
Stage.align = "LT";


MainArt._x = 0;
MainArt._y = Stage.height;
SignalNav._x = Stage.width-(Stage.width*.1);
SignalNav._y = Stage.height*.15;

stageListener = new Object();
stageListener.onResize = function ()
{
SignalNav._x = Stage.width-(Stage.width*.1);
SignalNav._y = Stage.height*.15;
MainArt._x = 0;
MainArt._y = Stage.height;
}
Stage.addListener(stageListener);

Thanks for any help.

[F8] SizeListener.onResize Not Working
The code below works with loaded swf, jpg and png's, it basically centers my loaded image on the stage regardless of size and keep centered when i resize the browser.

My problem comes when i want to load a swf with a loaded flv file integrated, then the resize of the browser (which is connected to the stage size of my main swf) repositions my img_mc to x=0 although the y pos is not effected and still works?

any ideas???

rat



function startPos() {
img_mc._x = (Stage.width - img_mc._width) / 2;
img_mc._y = (Stage.height - img_mc._height) / 2;
}
startPos();


sizeListener = new Object();
sizeListener.onResize = function() {
startPos();
};
Stage.addListener(sizeListener);


var mclListener:Object = new Object();
mclListener.onLoadInit = function(img_mc:MovieClip):Void {
img_mc._x = (Stage.width - img_mc._width) / 2;
img_mc._y = (Stage.height - img_mc._height) / 2;
}

mclListener.onLoadError = function(img_mc:MovieClip):Void {
img_mc.createTextField("error_txt", 1, 0, 0, 100, 20);
img_mc.error_txt.autoSize = "left";
img_mc.error_txt.text = "Error downloading specified image;
" + img_mc._url;
}

var myMCL:MovieClipLoader = new MovieClipLoader();
myMCL.addListener(mclListener);
myMCL.loadClip(imgUrl, img_mc);

StageListener.onResize Not Working In IE
Here's what I have:


Code:
stageListener = new Object();
stageListener.onResize = function() {
resizeScale();
};
Stage.addListener(stageListener);
function resizeScale() {
container._width = Stage.width;

}
resizeScale();
_root.empty_mc.loadMovie("spine.swf");
The background animation works, but it doesn't go the full width that it is supposed to in IE. It works fine in Safari. Any suggestions?

[MX] Centered OnResize Question
Just wondering if it is possible to get a flash site that is centered, onResize get a movieclip to range bottom?

I can get it to work when it is range "TL" but I want the site to be centered. When the site is centered, and I resize the window, the movieclip I want to be range bottom ranges beyond the window size and can't be seen.

I wonder if anyone else has had this issue and how they solved it.

Thanks in advance

Candice.

Component OnResize Question
Hi All,

I am having a bit of a mare! I have an fla that basically contains a full screen/liquid layout - with effectively two main movieclips - one is just for navigation and the other is for main content (CENTERpages)

Within this CENTERpages mc - I have a series of frames - one of the frames has a component object - for some reason this frame throws a wobbler on resize!!!

Is there any way of making the component stay in it's relevant position when I resize? This script controls the rest of the positioning of the elements


PHP Code:




///////////STAGE/////////////////////////////////////////////////////////////
Stage.align = "TL";
Stage.scaleMode = "noscale";
Stage.addListener( this );
function onResize(){
    
    myMENU._x = 0;
    myMENU._y = Math.floor(0);
    myMENU.menuCONTENT.bgMENU._width = Math.floor(Stage.width);
    myMENU.menuCONTENT.RBUTTON._x = Math.floor(Stage.width);
    
    CENTERpages._x = Stage.width / 2 - CENTERpages._width / 2;
    CENTERpages._y = Stage.height / 2 - CENTERpages._height / 2;
    centerX = Stage.width/2; // **** ADD HERE
    centerY = Stage.height/2; // **** ADD HERE
    }
onResize();







the component is on a frame within the CENTERpages MC - but I also to add a reference in that script above like so:


PHP Code:




///////////STAGE/////////////////////////////////////////////////////////////
Stage.align = "TL";
Stage.scaleMode = "noscale";
Stage.addListener( this );
function onResize(){
    
    myMENU._x = 0;
    myMENU._y = Math.floor(0);
    myMENU.menuCONTENT.bgMENU._width = Math.floor(Stage.width);
    myMENU.menuCONTENT.RBUTTON._x = Math.floor(Stage.width);
    
    CENTERpages._x = Stage.width / 2 - CENTERpages._width / 2;
    CENTERpages._y = Stage.height / 2 - CENTERpages._height / 2;
CENTERpages.componentname._x = Stage.width / 2 - CENTERpages.componentname._width / 2;
    CENTERpages.componentname._y = Stage.height / 2 - CENTERpages.componentname._height / 2;
    world._x = Stage.width / 2 - world._width / 2;
    world._y = Stage.height / 2 - world._height / 2;
    centerX = Stage.width/2; // **** ADD HERE
    centerY = Stage.height/2; // **** ADD HERE
    }
onResize();







but that just seemed to send it even more out of position and didn't even wait for the resize just put it half on and half off the top of the stage!!!!

Is there any way of making the component play ball with the onresize call?

Anyone had experience of positioning components within movieclips?

?

[F8] OnResize Play Function
Hi

Have a small issue, that I hope you can help me with:

I've got a fullscreen Flash website, and want to move a MC around the stage according to the browser size. This isn't the actual problem, but I want to do this with a tween animation. I'm using Fuse, to do the tweening, but I of course only want to call the animation function once. This when the user is done resizing the browser on not while the browser is resizing, as the onResize listener calls my animation function too often causing a pretty bad animation. Tried using a setInterval(), but didn't realy succeed. Hope my explanation wasn't too confusing!

Actually what I'm searching is this effect:
http://www.nigelwalker.co.uk/

Any suggestions?

Thanks in advance!

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