stage.stageWidth & Height not working: 1009

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.

I'm rather hoping that someone will be able to shed some light on what I'm hoping is a novice error. (I'm very new to using class files.. as in.. this project new).

This is the code for the working "":
ActionScript Code: package com.components{ import flash.display.Shape; import flash.display.MovieClip; public class messageBox extends MovieClip { public function messageBox():void { drawBacking(); } public function drawBacking():void { var rectangle:Shape = new Shape ;// initializing the variable named rectangle;, 0, 100, 100);; rectangle.alpha=0.5; addChild(rectangle); } public function clear():void { var num:int = this.numChildren; for (var i:int=0; i

Posted On: Friday 19th of October 2012 03:27:53 AM Total Views:  259
View Complete with Replies

Related Messages:

Papervision: Tweening Plane height   (79 Views)
I've been googling this for about two hours and coming up seriously short. In AS3 using Tweener, I'd like to be able to tween the height of a plane in Papervision. However, using the following (where p is the Plane): PHP Code: Tweener.addTween(p,{height:moveTo,time:1}); I get 'Property height not found on org.papervision3d.objects.primitives.Plane and there is no default value'; so while you can define the height as an argument when defining a plane, you can't access it later. Does anybody have any suggestions on how to do this It's driving me to distraction :/
ScrollPane width and height   (114 Views)
im having problems with the scrollpane width and height not being reflected in its parent DisplayObjectContainer. Example: Code: package{ import fl.containers.ScrollPane; import flash.display.*; public class ScrollPaneDimensionsTest extends Sprite{ public function ScrollPaneDimensionsTest(){ var sp:ScrollPane = new ScrollPane(); sp.setSize(200, 200); var sprite:Sprite = new Sprite(); sprite.addChild(sp); trace(sp.width); //prints 200 trace(sp.height); //prints 200 trace(sprite.width); //prints 115!!!! trace(sprite.height); //prints 115!!!! } } } Any ideas why this is printing 115 instead of 200
width and height set in HTML --where do I find them in AS3?   (246 Views)
hi, this may be a lame question but.. what exactly is "stage", or "Stage" in AS2. I mean.. the stageWidth property (Width in as2) - it's the width of my flash movie, which I set in document properties in flash, right by default, when you create a new fla, it's 550. but where do I find the width value set in the HTML file when embedding the swf
Tweening Clips greater than 2880 in width or height?   (117 Views)
any ideas on how I should go about tweening a mc thats greater than 2880 Would breaking up the jpeg into 2 parts be the most efficient way
Just making sure - Empty Movieclip - addChild - no width/height   (185 Views)
a, I'm trying to make my site Fluid but the problem is my menu is created with a for loop and addChild. These childs are pushed inside an array and this array is within an empty movieClip. But when I try to place this menu at the center [ ((stage.stagewidth / 2) - (menuGroup.width / 2)) for X, you know the drill for Y] it won't get centered because with a few traces I figured out the holder movieClip has no width and height. Is this normal I thought the movieClip is supposed to automaticly have a width and height assigned to it according to its content Well I hope I made myself clear MJ
100% width and height   (166 Views)
Hi people, I've been learning AS3 in the past few weeks but I am a bit confused at the moment. What can I do to have a movie clip occupying 100% of the window's width and height in every resolution. Example:
lib-linkaged-BitmapData ignores the width and height?   (197 Views)
Well, I have a bitmap imported to my lib, and I linkaged it with a name "PNGBitmapData", Then I can use new PNGBitmapData(WW,HH) to create this bitmap, it's very convenient. But as the constructor of "BitmapData" receives two parameters as width and height, i can specify the size of this PNG image. But no matter what number i use, even (0,0), the bitmap is just shown there. Nothing is different. So, are these numbers just ignored by the FlashPlayer
change swf height and width according to content size   (123 Views)
hi, I've implemented a video player to integrate into my Drupal website. I would like to assign different width and height size to my swf according to the videos sizes. How can I do it Should i pass back values from Flash app with an External Call Can I retrieve the height and width of the video before to pass it to flash app, so I can set the html wrapper parameters in advance
Flex read the height of a VBox   (149 Views)
i have a VBox. i fill it with some children. Each children having a different height. i didn't specify any height to my VBox ... so that it will resize to it's content. Ok. But how can i now read the height of my VBox i mean how can i find out how much space it takes I tried to use myVBox.getRect(this).height but it always returns 100 ...
How to change the text position in a small heighted combo box component?   (149 Views)
I have a combobox instance and it's very small, the height value is only 19. There are enough space for the text in it (in the combobox, not the opened list) to be shown, but just need to change the top margin of that text. You will know my question easily by taking a look at my attachment.
[AS3] TextField height   (86 Views)
How do I predict the TextField height When I initiate one, it comes with 100 height, but I want to set it to the fonts height. I have tried the autoSize, but some times it shrinks the text field to a very tiny one, and some times it stays at fonts height, but I can't set its width anymore... Is there a solution to this problem
TextField... height problems   (113 Views)
I have a textField with a lot of stuff in it, so I'm creating a scroller using a mask. To do the math to make the scroller work right, I need the height of the textField. But the stuff in it is retrieved from XML and the length of it varies when it is updated, which is quite often. Is there a way I can find the height of just the text in the textField Does that make any sense to anyone
Inconsistent output of TextField.height   (111 Views)
! I am building a dynamic multi-line textfield that has a backdrop so I need to know about the height of the TextField. Strangely TextField.height will almost always return the right results. But sometimes (e.g. when the last line only has one word) it will return a wrong value with the last line missing. Am I doing something wrong Or is this known to happen. And is there a good workaround Should I use getBounds instead
changing width of sprite also seems to change it's height...   (233 Views)
Here is some code I have. Code: _buttonUnderline = new Sprite(); with( { lineStyle(4, 0xACACAC); moveTo( -2, 0); lineTo(2, 0); } _buttonUnderline.x = + 104 / 2; _buttonUnderline.y = + + 10; addChild(_buttonUnderline); new Tween(_buttonUnderline, "width", Elastic.easeInOut, _buttonUnderline.width,, 1, true); When the Tween takes place though it not only changes the width, it changes the height as if it were scaling it up in both directions. Why does this behavior take place And how can I get it so that only the width changes I have also tried using scaleX as the property but it does the same thing.
How to change the width and height of an image loaded in a movieclip   (139 Views)
Hi I would like to know how I can modify the size properties of an image that is loaded in a movie clip with Loader() In my example, if I change the width and height properties of the movieclip in which the image is loaded, the image can't be seen anymore If I don't modify the width and height properties, then the image can be seen What should I modify in my code so that I can change the size properties and still have my image on the scene Here is my code Code: var imgLoader:Loader = new Loader(); var image:URLRequest = new URLRequest('model.jpg'); var imgDisplay:MovieClip = new MovieClip(); imgLoader.load(image); imgDisplay.addChild(imgLoader); // if I change width or height, // the image can't be seen, why imgDisplay.width = 50; imgDisplay.height = 50; addChild(imgDisplay); many
Creating a grid of movieclips and adjusting the grid based on stage width and height   (142 Views)
can anyone help me in creating a class or pointing me to a tutorial that shows how to create a grid of movieclips in as3 and also allows the grid to change column num and row num based upon the stage width and height
widht & height of a mc = 100% ???   (92 Views)
im figthing to find a code that hrlp me on this task and i want to know if someone find it or know how to do the next: i insert a swf widht the swfobject.js method the movie is placed on the html as 100% on widht and height and i set the param of scale as "noScale" this swf is in a popup that opens at fullscreen then i want to make that a mc inside the swf fit at 100% of widht and height, but i dont use allowscale coss if i load a mc inside, the text is gonna be all broken (specially if i use bitmap text). so, does anybody knows how i can make that a mc would be fullscreen as a property i know is with the Stage acs but dont know how to use it all the examples i found are used to align a mc, but i want to scale it to fit on the window
textField -textHeight or _height, real values... how to get them?   (84 Views)
Hi ! Ive a movie in which I created several boxes with textFields inside (they are filled with some xml data). The thing is, I have to set them in place within the box, but I dont how to get rid of the space up and down the text (with a autosize true textfield). Here is an image so you can see what Im talking about... I would like to have the same margin top and bottom, as the the margin right and left... any ideas thanks anyway! the code Code: for (var i=0; i 3) { txt_txt.setNewTextFormat(vagB14); trace("adsad") } else { txt_txt.setNewTextFormat(vagB); } txt_txt.text = newsletters[target_mc.num][i+1]; } function setTxt(temp:TextField){ temp.multiline = false; temp.wordWrap = false; temp.embedFonts = true; temp.autoSize = true; temp.condenseWhite = true; temp.border= true; } var vagB:TextFormat = new TextFormat(); vagB.font = "vagB"; vagB.size = 28; vagB.letterSpacing = 0; vagB.color = 0x000000; var vagB14:TextFormat = new TextFormat(); vagB14.font = "vagB"; vagB14.size = 14; vagB14.letterSpacing = 0; vagB14.color = 0x000000; var vagL:TextFormat = new TextFormat(); vagL.font = "vagL"; vagL.size = 14; vagL.letterSpacing = 0; vagL.color = 0x000000;
bitmapData's dimensions (width and height)   (178 Views)
I'm new to flex and I have a question concerning bitmapData and its width and height. Normally you set up bitmapData like this in AS3: Code: var bd:BitmapData = new BitmapData(100, 100, true, 0x00000000); var bm:Bitmap = new Bitmap(bd); But in Flex embedding an an image works like this: Code: [Embed(source="../../../../../assets/sprites/asteroids/asteroid_32_full.gif")] public static const Asteroid1:Class; var imageBM:Bitmap = new Library.Asteroid1(); When using the bitmapData (e.g. imageBM.bitmapData) I don't have to set up width and height any more. Does the Flash player know the width and height of a bitmapData automatically even when NOT setting up the bitmapData's width and height I'm totally unaware about this topic because I don't know whether the Flash player always knows the dimensions of a bitmapData. Could this cause problems when not setting up the dimensions of a bitmapData Thank you very much.
Width/height properties lost in class instances   (113 Views)
So... In a class I load an xml file from which i make several textfields (I put those in a sprite container). When I make instances of this class in the .fla file, the width and height properties of these instances are equal to 0, but they normally appear on screen and are accessible. Why width/height properties disappear and how is possible to access these properties Thanx!