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
Similar Posts:
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
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
Nov 15, 2010
I use mxmlc to compile as file,I use default stage.stageWidth to draw some grahpics,such [code]...
View 2 Replies
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
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
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
Sep 10, 2009
How do control the stagewidh and stageheight Using script in AS3?
View 1 Replies
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Mar 12, 2012
Does the value of Stage.stageWidth or Stage.stageHeight change as per the screen-resolution, monitor-size, browser etc ?
View 2 Replies
Feb 1, 2010
I'm trying to make a movieclip scale proportionally only if the item is being resize smaller than the current.Obviously I can use the ScaleX/Y values like so:
if (cont.scaleX < cont.scaleY ) { cont.scaleY = cont.scaleX; } else { cont.scaleX = cont.scaleY; }
I need to restrict/reset the scale proportions only in special case that the stageWidth/Height are smaller than the movieclip.
View 1 Replies
Dec 13, 2009
I am using SWFOBJECT to embed my flash content. I have been worried about stage.stageWidth and stage.stageHeight returning 0 in Firefox/Internet Explorer; this problem is referred to in question #21 on the SWFOBJECT FAQ [URL]..I have been told that this problem is particularly prevelant on Macs. The SWFOBJECT FAQ (question 21) indirectly suggests that this problem does not occur with static publishing. Is this correct? Is it still advisable to implement a solution to this stageWidth/stageHeight problem, even if you are using static publishing?
View 1 Replies
Jun 18, 2010
I've been working on a project that requires lots of scaling around a center point.
I always thought that stage.stageWidth and stage.stageHeight give you the dimensions of the stage you set in the properties panel no matter what. But when I went into fullscreen mode (with scaling), both the width and the height changed to the dimensions of the screen rather than staying the dimensions I specified.
View 1 Replies
May 17, 2011
In my AS3 code all the elements on the page are dynamically positioned depending on the current width and height of the SWF - providing it's not under a certain value, then the items are back in their original position.
When debugging in the Flash player the size all reports correctly however when run from a web browser it does not - initially.
This is my HTML & PHP code for the entire page:
HTML Code:
<?php
function hashId($fn) {
$hash=md5_file($fn);
[Code].....
But I cannot get the size to report correctly without, say, clicking a button.
It seems to me like I need to force flash to re-draw the screen, but I had no luck trying to do that.
View 8 Replies