This content has been marked as final. Show 6 replies
i'm still new to AS also, but from what i understand you can adjust swf properties two ways from a class. you can use this format
[SWF(width="800", height="800", backgroundColor="#FFFFFF", frameRate="31")]
or individually like this.
-default-size WIDTH HEIGHT
not sure if this helps at all, but i figured id give you something to experiment with till a real coder comes on here and gives the right answer :P..lol good luck^^
Thanks, unfortunately that's not what I was looking for.
you can usually get them with something like
but those vars will not be available yet in the initialization of the class instance. In the enterFrame function, they should be.
>>Is there a way of accessing stage propertys from within a class in actionscript 3?
Yes, there are couple of ways I know! You can create a document class. In that case you can directly access stage object. Another way is to access stage object using "Sprite.stage".
>>I need to access stage.stageWidth & stage.stageHeight.
Follow this link for quick example: http://tush.wordpress.com/2007/06/25/action-script-3-resize-swf-on-browser-resize/
Hope this helps!
Because of the changes in the way Flash handles the stage, each item in the display list derives properties from the Stage Object i.e. width, height etc.
In AS1 and 2, accessing the Stage height and width (and most properties) was done with a ._width or ._height. In CS3 (and AS3), it's simply .width or .height.
You should be able to just go from the main timeline using this.width or this.height....not 100% on that but I'd give it a go. Don't have CS3 on my mac at work so I can't confirm it for you...it's at home on my laptop.
Also worth mentioning.... If you are getting errors when trying to call these properties, make sure you've actually drawn something to stage. AS is still run before graphics drawn on the stage and so if you don't use addChild( someClip ); in the first class that needs to access the stage, then nothing is there for it to access and Stage will be a null object reference.