ActionScript 3.0 :: Get The Stage Size From A Component?
Jun 1, 2009
I have a component, in which I am trying to create a sprite the size of the stage. But stage is null:
var bg:Sprite = new Sprite();
this.addChild(bg);
bg.graphics.beginFill(0xFF0000);
bg.graphics.drawRect(0,0,stage.width,stage.height);
What am I missing here? If I put something similar in the document class, it works.
View 1 Replies
Similar Posts:
Jun 26, 2009
Im trying to create a layout in flex using mxml, the layout contains a Canvas component and a Box. The layout should always be such that the Box sits at the bottom edge of the application and has a fixed height, whereas the Canvas fills the remaining stage area and does not overlap with the Box. My MXML is as follows;
[Code]...
View 3 Replies
Dec 29, 2009
I'm trying to get an object to increase in size the lower it goes down the stage, and decrease in size the high it moves up the stage.
It only needs to increase or decrease by a small amount. Basically, it's for a game character. To ad realism to his movements, it would be nice to have this feature.
This is where i'm up to so far:
Code:
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
[code]....
I think I need something like:
if (object moves up)
decrease
else if (object moves down)
increase
View 6 Replies
Mar 3, 2011
I want to create a panel (or any other component) inside a component that has a 5 pixel border on all sides, but scales fully when the window is resized. I know I can set width to "100%" to make it resize, but that gives me no borders. If I put it to "95%",I have borders, but they scale annoyingly. Also, that only works for borders on the right or lower bounds, and not to the left or upper sides.Is there a convenient way to do this without having to write tons of resize-code (in which case I will not bother and just accept bad rescale behaviour, as it is for a private pet project).
EDIT: I know that I can just overwrite the display handling and set the positions manually every frame. I wondered if there is a cheap way to do it in the mxml-structure, along these lines:
<mx:Panel>
width="100%" height="100%"
</mx:Panel>
Coming from C++ and Java, I am intrigued by the option of setting something to "95%" and let the library work out the details, instead of having to write many lines of code, just so my text-area always keeps a 5 pixel distance from the border, but scales with window width.If there is no easier way to do it than figuring out pixel sizes by hand and setting the coordinates.
View 1 Replies
Mar 1, 2010
I have following problem:
Code:
title_txt = new TextInput( );
title_txt.setSize( 100, 20 );
[code]....
View 4 Replies
Mar 30, 2010
I'm working on a slideshow where I'm calling in photos from an xml file. How do I tell AS to resize the stage according to photo dimensions? Would I need to list the dimensions in the xml file? If so, how would I pull that into the fla file with AS?
View 6 Replies
Jun 28, 2009
is possible to dynamically change the dimensions of my flash stage depending on the size of the browser window ?
Very important, I don't want to stretch any element. Just make the background bigger.
View 6 Replies
Jun 28, 2009
is possible to dynamically change the dimensions of my flash stage depending on the size of the browser window ?
Very important, I don't want to stretch any element. Just make the background bigger.
View 10 Replies
Dec 11, 2004
I'm building this game, and it was working fine, until I used the menuBar component. It's not code related, 'cause i've commented out the script that does things with the menuBar. If I drag the MenuBar component from the component window, onto my Stage , the game refuses to work. If I deleet it (but keep it IN my library), it still doesn't work!. But if I turn the export settings of the MenuBar off, it works! The classes that i'm using for my game are called Node.as, JawBreaker.as The class I want to use to do something with the menuBar is called GameMenu.as (but that doesn't matter, since I commented the calling of that class out).
View 1 Replies
Sep 7, 2010
I'm making a mockup for a client and I need to Load the .swf with the exact stage size so the graphic elements do not float outside the loaded movies stage area. [URL]Basic load code I'm using...
Actionscript Code:
import flash.display.*;var adLoader1:Loader = new Loader();adLoader1.load(new URLRequest("100828_budlight_texas_fight_728x90_jn.swf"));adLoader1.x = 313;adLoader1.y = 162;addChild(adLoader1);var adLoader3:Loader = new Loader();adLoader3.load(new URLRequest("100828_budlight_texas_fight_300x615_jn.swf"));adLoader3.x = 738;adLoader3.y = 0;addChild(adLoader3);
View 3 Replies
Dec 22, 2010
All I want to do is have a scrollPane component on the stage and within that component I would like to have a movieclip that is essentially a list, and each list item is a button to be clicked on. I have no problem doing this if I have buttons within a movieclip, but having them in a scrollPane produces the following error:
1119: Access of possibly undefined property mcButtons through a reference with static type fl.containers:ScrollPane.It seems that I am unable to use the scrollPane component as if it were a movieclip and to use dot syntax to access it's content.
View 2 Replies
May 28, 2009
Here is my code that plays the video:
import fl.video.*; var myVideo:FLVPlayback = new FLVPlayback(); myVideo.source = "video.flv"; } addChild(myVideo);
How to I set the size of the video? I have tried "myVideo.videoWidth = 400;" but that gives me an error.
View 3 Replies
Jan 19, 2011
I'd like to get the actual height of a component after adding some children.
When inspecting the variables tab in debug mode, I see 2 different height variables:$height (which contains the correct value: 138) and height/_height (which contains a wrong value: 10).
I guess that the display is not updated and so I'm not getting the correct height using component.height, but how can I get the value in $height?
[Code]...
View 2 Replies
May 16, 2011
I have DataGrid with horizontal scrollbar. How can I get its visible width?
View 1 Replies
Apr 7, 2009
Something I've always wanted to do was creating a custom component in Flash but havespecific parts of the component size appropriately based on, say, the video size.For go there and watch a video... they use the same component for all sizes of video. What seems to be changing is the video width and height, the progress bar width and the position of any status messages for the video.
View 1 Replies
Dec 20, 2009
How can I set a size for my DataGrid component's cells?
View 1 Replies
May 24, 2011
I'm trying to alter the text size on a button component.I can get in and alter the button graphics properties (color, etc.), I can change the text in the instance properties 'component parameters', and change the text placement, however I don't see where to alter the font size or the font.
View 4 Replies
Mar 22, 2010
I have a viewstack with 3 items in it. Now my problem is that I want all these components to be of the same size. Its simply enough to do this manually but is there any other way of setting the size for all the components at once?
View 2 Replies
Feb 25, 2011
If a drag a component from the library into a movieclip and then drag the movieclip to the stage. Now if i resize the movieclip, can I set the component with a fixed width or height?
View 1 Replies
Mar 10, 2009
I'm trying to make selectable thumbnail images for a touch screen app where the user can touch the thumbnail image and turn a CheckBox on or off to select/deselect it.
The thumbnail images measure 100x100 pixels, and I want the CheckBox to be in the upper right hand corner of each image. When I go to the Adobe AS3 help site, it says that it should be possible to increase the size of the CheckBox hit area in one of two ways:
1) Select the component on the Stage and use the Free Transform Tool or any of the Modify > Transform commands.
2) Use the setSize() method or applicable properties of the CheckBox class.
According to this same site, if you increase the size of the instance, you also increase the size of the hit area.
I've tried both of these, and none expand the hit area over the entire thumbnail. In fact, neither seems to increase the size of the hit area at all. In order to select a particular thumbnail, the user still has to hit the CheckBox.
View 1 Replies
Feb 26, 2011
I tried this but doesnt works: var tf:TextFormat = new TextFormat(); tf.font = "Arial"; tf.size = 25; tf.bold = true; list.setStyle("textFormat", tf);
View 3 Replies
Sep 9, 2009
I'm building a flex .swc library using Ant, and many of the assets that are supposed to be in the file are not being copied, instead creating 0-byte entries in the .swc.Here is the ant compc target that is doing the creation. I've tried both compiler.include-libraries and compiler.library-path here, which is why the latter is still present and commented out. Neither worked.
<compc headless-server="true"
default-frame-rate="${flex.default-frame-rate}"
debug="${flex.compiler.debug.mode}"[code]....
View 1 Replies
Nov 16, 2010
I have a component and I add some content to it making it change it's size, immediately I need it's new size, but flex only updates the size in the next frame by calling updateDisplayList. how can I force it to update the size of the component right away.
View 1 Replies
Sep 12, 2009
Is there anyway to do this? By default it automatically re-sizes according the the content in the target dynamic text field. I'd like to have it's size fixed, but I don't see any obvious way to do that in the documentation.
View 2 Replies
Aug 15, 2010
this must be possible but i can't find any info on it. how do i increase the size of the combobox component scroll bar? i know it's a list component but i can't figure out how to set it's size. i want to use it with a touch screen and it's much too small.
View 3 Replies
Sep 2, 2008
I am attempting to reskin the AS3 Slider component to have arelatively "tall" draggable thumb graphic. However, the sliderthumb always seems to be forcibly scaled down to 13x13 regardlessof the size of the graphic. I'm currently using the drag-and-dropcomponent on workspace method, and double-clicked the livepreviewto change the skin pieces.I've tried resizing the contents of the SliderThumb_*Skin(upSkin, downSkin, ...) symbols, the Slider component itself on thestage, and even the placeholders on the double-click skin organizersheet. The height of the thumb object is not directly accessible(seems to be private). The translated position of the 13x13 thumbrelative to the symbol center is preserved correctly... but thesize seems to be stuck at 13x13.
Is there a workaround for this? I've searched and found a fewFlex solutions having to do with overriding a measure() method orextending the class to hard-code a different height, but none ofthe corresponding classes (e.g. one site recommended extendingmx.controls.sliderClasses.SliderThumb) seem to be accessible withinthe Flash AS3 implementation of the components.
View 2 Replies
Nov 20, 2009
I changed from using a text field to a textArea component and now the font size is much smaller.The original text field had the font size set to 10 and Arial, just like I think I am doing with the TextArea but it appears to be coming up at about 3/4 the size it was before.
Code Snippet:
myTF = new TextFormat("Arial", 10, 0xFFFFFF,false);
myText_mc.myTextArea.setStyle("textFormat", myTF);
[code].....
View 17 Replies
Nov 16, 2009
Is there a good place that has an overview of how Flex layout stuff is managed? I'm trying to create some user-resizeable "windows" in Flex, but I'm having some trouble getting the layout calculations for the contents correct. Right now I'm just trying to get a good understanding of how Flex calculates its layouts, but I haven't found any good overview documentation. For instance, looking just at the width value there are the following:
[Code]....
and the same set for height. What's the meaning of each of these? How is each used? Is there any way using those to calculate some preferred size of a component (like getPreferredSize() in java)?
View 3 Replies
Jan 21, 2010
I want to use the checkbox component in my flash app, but it's really tiny. According to this article 1, the size and scale parameters only affect the invisible bounding box. Does anyone know of a quick solution on how to scale up (enlarge) the visual area of the checkbox component in flash CS3?
View 2 Replies
Mar 7, 2011
How can I set font size of title property (header) in TitleWindow component? If I use fontSize property, it sets the font size for all components in TitleWindow, which is not what I want. I only want to set it for the title. I'm using Flex 3.
View 1 Replies