ActionScript 3.0 :: Can't Use StageWidth For Positioning When Resize

Sep 5, 2010

I'm trying to get the width and height of the stage to position my objects when the user resizes the window, but I can't figure out how.

I've Googled a lot and found some examples and my last try looks like this [code]...

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Positioning After Stage Resize?

Aug 25, 2011

coordinates in flash, particularly after resizing the flash player window.I have an mc on stage and draw an ellipse inside that mc. The movie is of size 800 x 600.

Code:
var ellipse:Shape = new Shape();
ellipse.graphics.beginFill(0x6CCDF4, 0.5);
ellipse.graphics.lineStyle(4,0x186B87);

[code]....

If I check the coordinates of that ellipse from it's transform property, I see that the top left is at 400, 300.

Code:
ellipse.transform.pixelBounds.topLeft.x
ellipse.transform.pixelBounds.topLeft.y

This seems fine to me as this position is in relation to the stage, yes? If I convert this to a position local to the container I get values ~0,0.

Code:
var stagePoint:Point = new Point(ellipse.transform.pixelBounds.topLeft.x, ellipse.transform.pixelBounds.topLeft.y);
var localPoint:Point = join.canvas.globalToLocal(stagePoint);

When the flash player window is resized, the coordinates change entirely. Instead of being at 400,300 the transform property indicates that it is at 640, 510. I assume this is because the viewport has changed, but the stageWidth and width properties of the stage do not change.

View 12 Replies

ActionScript 2.0 :: Dynamic Positioning Only Working After Resize

Jul 7, 2009

URL...Its a dynamic positioning template, basically.I'm importing docked_icons.swf onto the stage via the holder movie clip (at the end). However, the position is messed up until I resize the window. From there, it's perfect. How do I set the initial position to be correct?[code]

View 1 Replies

Flex :: 3 - Auto-sizing - Automatically Resize To Fit The Length Of The Content And Positioning

Jan 4, 2010

I am working on a flex app that uses XML templates to dynamically create DisplayObjects. These templates define different layouts that can be used for each page of content in the app (ie , 2 columns, 3 columns etc etc). The administrator can select from one of these and populate each area with their content.

The templates add one of 3 types of DisplayObject - HBox, VBox or a third component - LibraryContentContainer (an mxml component that is defined as part of the app) - which is effectively a canvas element with a TextArea inside. The problem that I am getting is that I need each of these areas to automatically resize to fit the length of the content but don't seem to be able to find an effective way to do so.

In the LibraryContentContainer, when the value of the TextArea is set, I am calling .validateNow() on the LibraryContentContainer. I then set the height property on both the TextArea and LibraryContentContainer to match the textHeight property of the TextArea. In the following example, this is the LibraryContentContainer, viewer is the TextArea and the value property of the TextArea is bound to this.__Value. v is the variable containing the content for the textarea

[Code]...

View 1 Replies

How To Get Actual StageWidth

Apr 8, 2011

I am trying to get the stage width of the FLA in as3. Obviously, stage.stageWidth works well, the only issue is that when viewing the the SWF in an HTML page when you are zoomed in or out it gives you the relative width of your current view. For example, my stage width is 800x600 and when I trace out the stage.stageWidth it is showing up as 800 as long as I am viewing in my browser at 100 percecent, but once I zoom out in my browser the stageWidth gets traced out as a smaller number. Does anyone know how I can dynamically get the stageWidth of the FLA and have it not change regardless of how you are viewing the HTML page

View 1 Replies

ActionScript 3.0 :: How To Set StageWidth

Nov 14, 2010

I use mxmlc to compile as file,I use default stage.stageWidth to draw some grahpics,such as:

[Code]...

View 1 Replies

ActionScript 3.0 :: How To Get StageWidth

Jun 15, 2010

I have a 2 swfs, home.swf loads into main.swf. However the stageWidth/Height that I defined they are now pointed to main.How can I get stageWidth and stageHeight pointed to home.swf instead?

View 1 Replies

ActionScript 3.0 :: Way To Set StageWidth

Nov 15, 2010

I use mxmlc to compile as file,I use default stage.stageWidth to draw some grahpics,such [code]...

View 2 Replies

ActionScript 3.0 :: StageWidth In Swf = 800 In Browser = 0?

Dec 16, 2009

When I test the swf straight from Flash, the stageWidth is 800 pixels. This is correct. When I load the swf using an HTML page in Firefox, it tells me the stageWidth is 0. I've stripped the whole thing down to just the following script and slapped a bright green frame into the first layer of FLA so I can see the edges of the stage. The SWF is displaying at 800 X 800 but the number displaying in the text field is "0" in a browser, and "800" when the swf is playing stand-alone.
 
package com.maijag.threedee{        import flash.display.*;    import flash.text.TextField; 
public class SwarmTest extends Sprite {        private var myParent:Object;
public function SwarmTest() {            myParent = this;           // this textField is just to see what the stageWidth is in

[code]....

View 6 Replies

ActionScript 3.0 :: Acessing Root Stage.stageWidth?

Sep 2, 2009

So I'm trying to do a simple graph with rollover definitions. I have the graph on one layer in the root along with the definitions. On a hit testing MC I have the following:

var defbox:info = new info();
var mcName  = this.name;
var xPos =  (MovieClip(parent).stage.stageWidth)/2;

[code]....

View 5 Replies

ActionScript 3.0 :: Control The Stagewidth And Stageheight Using Script?

Sep 10, 2009

How do control the stagewidh and stageheight Using script in AS3?

View 1 Replies

ActionScript 3.0 :: Preloader Matching Stage.stageWidth ?

Oct 8, 2010

Experimenting with Flash as usual.Preloader's are always something that have caused me trouble.Here's what I typically use for a timeline based preloader in AS3:
 
 this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void {
var total:Number = this.stage.loaderInfo.bytesTotal;[code].......
 
I'm really interested in a preloader that loads right across the stage however - regardless of if the stage is resized.I should imagine it'll involve implementing = Math.round(stage.stageWidth); at some point?

View 9 Replies

ActionScript 3.0 :: Stage.stageWidth In Percent Not Pixels?

Feb 18, 2012

I am trying to set masks and other component positions in relation to Stage size.AS3 CS5I trace stage.stageWidth on a 800x600 pixel stage and I get - 100My stage will scale within a Director piece.Is this a bug? Modal condition? Releated to scaling??

View 7 Replies

Flash :: Not Getting Stage.stageWidth And StageHeight On Firefox 3.5?

May 31, 2010

I'm having issue regarding the display when using Firefox 3.5 on MAC, I can see my menu and the display is correct. The menu just position above what it supposed to be positioned. It works fine with Safari on MACOSX.My flash size is: 1440x750It looks like Firefox can't recognize stage.StageWidth and stage.StageHeight. It returns 0.Some suggest implementing was to pass in the actual width and height of movie via FlashVars. The movie uses these instead of stage.stageWidth and stage.stageHeightDoes anyone have an example of code of how to fix that issue??

public function Main()
{
addEventListener(Event.ADDED_TO_STAGE, handleOnStage, false, 0, true);

[code]....

View 1 Replies

Actionscript 3 :: Flash - StageWidth Wrong In Firefox 3.6?

Apr 20, 2011

I have a full-windowed SWF running in Firefox3.6.Reading stage.stageWidth should follow the size of the browser's window, but that's not the case with Firefox! The minimum stage.stageWidth I get is 925, even if I make the Firefox window much smaller than that.stage. stageHeight seems to work fine though.This is because the (my?) Menu Bar won't go below 925 pixels wide. The problem is solved if I hide the Menu Bar!

This problem only appears on Firefox. Anyone knows if there is a work around? I can't ask users visiting my site to turn their menu bar off in order to see it correctly.

View 1 Replies

ActionScript 3.0 :: Referencing Stage.stageWidth From A Class

Jan 7, 2009

I created a custom class in a .as file. I then linked this custom class with a symbol from the library in my .fla file. However, I can't reference stage.stageWidth in my custom class file. I get a null object error.

I think this happens because the custom class file is associated with a symbol on the stage and not the stage itself. For example, if I set the fla file's Document Class to the name of my custom class I can reference stage.stageWidth in the custom class. But I don't do this because I am creating multiple instances of the symbol on the stage. In order to do that properly i found I have to set the class in the properties panel of the symbol to the underlying class which then defines how each symbol behaves.

Under this type of linkage, is there a way to reference the stage width from the class? I've tried root.stage.stageWidth and parent.stage.stageWidth to no avail. I also made sure to import flash.display.* in my custom class. Below is the code for my .fla file and my .as file. In the .as file you'll see the line "x = Math.random() * stage.stageWidth;". This is the line giving me problems. I could hard code it, as I do for the y variable on the next line, but I'd prefer not to in order to keep the code flexible.

[Code]....

View 3 Replies

ActionScript 3.0 :: Loaded Swf Accessing Stage.stageWidth?

Sep 19, 2009

The old loaded swf issue. How can I keep the dimensions of the loaded SWF to that of its FLA, and not to the new stage where it is loading? I know there is only one stage, so i just have to hard-code this into the loaded SWF right?

View 9 Replies

ActionScript 3.0 :: Call Stage.stageWidth From Class?

Mar 29, 2009

I made a class to create and handle a google map in my swf and everything works very well. But I want to make my layout completely liquid. To acomplish this, I need to call the stage from the class... But it doesnt seem to be so easy.

the code is bellow:

[Code]....

View 3 Replies

ActionScript 3.0 :: Flash Defeated By StageWidth / Height

Jul 22, 2010

Well everything was going well until I tested my project in a browser (embeded using SWFObject if that matters). After all the troubleshooting, it turns out that the stageWidth/Height values were just 0 which threw off the whole thing. The stage is set up by the DocClass (some unrelated stuff taken out to make it shorter):

[Code]....

View 4 Replies

Flash :: How To Fix Stage.stageWidth And StageHeight To Be Recognized On Firefox 3.5

Jun 3, 2010

Working on personal full flash site and I can't really figure out how to make MC's position on Stage aligned on Firefox browser. Everything goes fine using Safari.

I have tried a method of set a timer every time it goes off (every 200 ms or so) it checks to see if stage.stageWidth > 0. If that is the case, do stop the timer and start resize on stage. However it's still not working on Firefox of MAC. :(

In my HTML code:

<link href="css/site.css" rel="stylesheet" type="text/css" />

Test Site

<script type="text/javascript">
var swf = new SWFObject("main.swf", "mymovie", "100%", "100%", "10", "#000000");
swf.addParam("allowScriptAccess", "always");

[Code]....

View 1 Replies

Flash :: Does ShowAll Change StageWidth On Embedded Content

Dec 16, 2011

I've got a MovieClip that gets positioned in respect of the stage.stageWidth/stage.stageHeight which works completely fine in the stand-alone Flash Player, however when embedded into a webpage with the "showAll" param it gets cropped. Is anyone aware of some sort of issue with stageWidth not being updated when using the scale param in the embed code?

View 1 Replies

ActionScript 3.0 :: Stage.stageWidth And Height Not Working: 1009

Jun 27, 2011

I've decided to start re-writing my project, but this time making the use of class files rather than nesting code inside my MovieClips.

Now it's come to the "message box" that I previously wrote, and I'm having some troubles. (note: I don't really want to download a pre-built one as my message box class end up being the backbone for several custom interfaces).The problem is that I cannot, for the life of me, figure out why my message box class cannot access "stage.stageWidth", "stage.stageHeight", "MovieClip(root).currentWidth", etc.

This is the code for the working "messageBox.as":

ActionScript Code:
package com.components{
import flash.display.Shape;
import flash.display.MovieClip;

[code]....

I've tried several variations of creating the movie clip, but to no avail. I've tried like creating a global movie clip variable and that attatching the movieclip to it in this function, the same with a display object, creating a function variable and doing both of the above, etc.I just cannot figure it out! All of my other classes are working just fine!

View 6 Replies

ActionScript 2.0 :: Make Horizontal Easing That Depends On Stagewidth

Sep 20, 2005

I want to make horizontal easing that depends on stagewidth. I have made all coding and it works fine, but text in easing MC becomes sometimes slightly blured. I use pixel fonts and the start position is a round number: x.0 y.0Is there any way to put some variable that makes corrections, like in some scrollers? Maybe it's impossible because when someone resizes browser window it isn't on round number, or it is?

View 9 Replies

ActionScript 3.0 :: Referring To Stage.stageWidth From Inside A Class?

Mar 17, 2009

I am building a simple ToolTip-Class. In case the cursor gets to close to the stage's border's I'd like it to flip accordingly, so it won't get cropped.

For this I'd like to compare the stage width and my mouseX and then scale and wove things accordingly.

However when I try to get stage.stageWidth from inside my package it will return null.

View 4 Replies

ActionScript 3.0 :: Keeping Large Objects From Affecting Stagewidth?

Aug 22, 2010

I have a large movieclip that I am adding to the stage (large in dimension, not filesize). Once it is there I plan to manipulate it's X position by clicking different parts of the movieclip. Unfortunately, where I am moving the clip to is based on stage.stageWidth, which changes as soon as you add this movieclip to the stage. So I can't make any accurate tweens or anything like that. Is there a way I can set objects to not affect the screen width when they are loaded? Or still access the property of the actual window's width?

View 3 Replies

ActionScript 3.0 :: 1009: When Referencing Stage - Stagewidth From The Child

Jun 3, 2011

I have a main.swf and a slider.swf. I load the slider.swf into main.swf. In my slider.swf I have this code which adds an image to the stage from the Library:

[Code]...

I assume it has to do with the stage.stageWidth. Is there a another way to reference the stage. If I load the the image externally via a loader I can use the stage.stage Width.

View 4 Replies

ActionScript 3.0 :: Tweening MC In From Side To A Length Of Stage.stageWidth - (set Amount)

Jul 19, 2010

I'm after a way to implement a similar style of navigation as the blue strip that enters from the right hand side of the stage on this website:
 
[URL]
 
I'm fairly sure it will revolve around the use of a stage.stageWidth listener on an mc and then subtracting a certain amount to ensure it doesn't span the entire width..

View 2 Replies

Actionscript 3 :: Why Does Stage.stageWidth In Flash Builder 4.6 Using Flex On Android Not Work

Jan 11, 2012

I am creating a android app using adobe air (flex sdk 4.6.0) and i am trying to find out what the width of the phone screen is in pixels. So I am fallowing the tutorial here but when ever i copy the code into my project and click run it always gives me this error "TypeError: Error #1009: Cannot access a property or method of a null object reference." and goes to the line that has stage.stageWidth I have also tried stage.width but it does the same thing. So does stage.stageWidth no longer work or how do you tell the screen size of the tablet or phone? Was it replaced with something else for phones? I am trying to get the information so i can center images in the center of the screen using action script.[code]

View 1 Replies

ActionScript 3.0 :: Scale Or Resize The Image By Dragging And Resize Option?

Sep 19, 2011

I am working on image and i like to scale or resize the image by dragging and resize option.same working as "free transform tool" in flash (design part); i need same functionality in application.

View 7 Replies

ActionScript 3.0 :: Browser Resize Doesn't Trigger Resize Event?

Jul 7, 2011

I'm having a bit of a problem here. As per the title, my flash swf file works fine when tested from the IDE, but when I publish it and open it through the browser, the stage doesn't seem to resize along with the window.I post below a bare-bones example. The "back" movie clip should resize, only it remains at the starting dimensions

Code:
import flash.events.Event;
import flash.display.MovieClip;

[code].....

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved