ActionScript 3.0 :: Flex Getting Width Of Sprite With Component Inside It?
Jun 3, 2009
why I can't get the width of a Sprite when it has components in it.
For example
Code:
var foo:Sprite = new Sprite();
addChild(foo);
var comboBox:ComboBox = new ComboBox();
[Code]....
I'm assuming the component possibly isn't set before I'm trying to get the width?
View 5 Replies
Similar Posts:
Oct 23, 2009
Given this code:
[Code]...
Why does changing the width and height of uiComp not affect the Sprite? Wouldn't UIComponent provide Sprite with a Graphics object, which limits that area where Sprite can draw?
View 1 Replies
Mar 5, 2010
I created a class, extended the sprite class, and now in the constructor I am trying to set the Sprite's width and height properties which are inherited from the DisplayObject. However, after I set this.width and this.height, and print the values, I get 0 for both.
What the heck is going on? When I view the livedocs I see that DisplayObject has width and height listed as public properties. I have been able to instantiate a Sprite directly, and set the width and height after it's been instantiated, so I don't get it.
package {
import flash.display.*;
public class ScrollBar extends Sprite {[code].....
View 1 Replies
Sep 23, 2011
Both of sprite.width and sprite.scaleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?
View 2 Replies
Jun 19, 2009
It has been a great resource of the years. No my problem. I am trying to dynamically resize a sprite that has a line drawn into it. Here is my code:
[Code]...
View 4 Replies
Sep 3, 2009
I have two components. One is called "InsideComp" and one is called "OutsideComp". OutsideComp has InsideComp as one piece of its component, and in my main MXML file, I have embedded an instance of OutsideComp. How do I access a public variable of InsideComp within my main MXML file?In Actionscript, I could just do something like:OutsideComp.InsideComp.valToChange = 5; But I dont know how to do it in MXML. I know this is probably an easy question.
View 4 Replies
Apr 15, 2011
i want to add UIComponent inside a spite. here is the code:
private function make() : void {
var circle : Sprite = new Sprite();
circle.graphics.beginFill(0xFF0000, 0.2);[code]......
the problem is that button is added, but is not displayed. if i do reversed - add sprite to uicomponent - everything works fine, but this way it doesn't work. i tried to use invalidate functions for button etc... even tried making "circle" as UIMovieClip, but no luck - button is still invisible. also if i simply do "addChild( button );" - it is shown,how can i add a button inside a sprite?
View 2 Replies
Oct 19, 2011
When using an mx:Canvas from the Flex api inside a Sprite, I'm getting a TypeError: Error #1009 and following stack:
> StyleManager/getStyleManager
> StyleProtoChain/getStyleManager
> StyleProtoChain/initProtoChain
[code].....
View 1 Replies
Jul 25, 2010
I'm playing around with code like this:
<s:Button id="test" label="test" transformX="{Math.floor(test.width/2)}" rotationY="20" x="20" y="20" />
The button is rotated on the Y axis and the rotate pivot is in the middle of the button.
This will create a button that looks something like this[code]...
I put together a sample to show off the various approaches for calculating this that people are suggesting. The source code is also available. Nothing is quite working like I'd expect. For example, turn the rotationSlider to 85. The button is effectively invisible, yet all approaches are still giving it height and width.
View 3 Replies
Jun 17, 2011
I've got a really simple Grid inside an ApplicationControlBar:
[Code]...
All I want to do Is make the Grid stretch 100% across the full width of the screen, however the above does not.
View 1 Replies
Nov 29, 2010
in flash builder 4 how do i use the skinning option to make sure the popup dropdown list changes it's width to fit the longest item in the list?(the prompt area - the component when it is closed - should not change it's width)
View 1 Replies
Dec 21, 2011
I'm having issues with implementing a flex button componentI have applied a CSS style to button and set border-color to, say #555555.So far, it works as expected.Then, when my application is resized, the border of the button component becomes blurred and its width automatically changes from 1 pixel to 2 pixels, which doesn't look very well.hen I maximize the app again, after the border is blurred, the buttons' border becomes 1 pixel and looks nice.
View 1 Replies
Nov 19, 2011
I'm trying to make a Flex Tree Component display the children of a sprite in a hierarchical way. Moreover, dragging the items on the FlexTree would resort and reparent the items. I have special Elements set as Folders. This would allow other elements to be added there as a children by dragging an element on the tree and dropping it there. I have a failed attempt which works, but breaks when I try to add folders. Basically, it fails at reparenting the items by dragging and resorting folders and that Does anyone know of a component or something which can do this, has anyone have created any of this or could anyone give me a clue?
View 1 Replies
Apr 1, 2011
I'm creating a custom component (based on ComboBox) and overriding some base methods. Recently I've found it acts weird when I set it's width in percents, rather than a fixed width. It tends to continuously call the commitProperties method and fail in the end. When I set it's width to fixed value - all works like a charm. What am I missing to implement? Here's some code ..
override protected function commitProperties():void {
super.commitProperties();
//some stuff ...
[Code]....
View 2 Replies
May 28, 2011
I'm extending the Flex 3 panel component. I need to figure out the width of the title's text. Because, title is a private variable in panel, I can't access it via title.width.I know the font, fontsize (14), and length of the title (which will vary). Knowing this info is there a way to calculate how many pixels wide the title is?
View 1 Replies
Nov 10, 2009
Does anyone know how to get the width and height in ActionScript for a Flex application running inside the flash player in the web browser.
e.g. In the web browser I can use the tag to embed a Flex application (as a .swf). To the embed tag, I can provide the dimensions. I would like to get these dimensions inside the flex application action script.
View 2 Replies
Feb 3, 2010
Everytime I google this question I see confusing information about masks and blends, none of which seems to directly apply to what I think should be an easy thing... There are three Sprites involved here...the lowest layer sprite is pretty much a background. I want to overlay a translucent Sprite on top of the background and then I want the third, top-most Sprite to act as a hole, so that the area inside the third Sprite is completely transparent, so that the background sprite is completely visible. How would I go about doing this dynamically (i.e. dynamically drawing the masking sprite and hole using the Actionscript graphics calls)?
View 4 Replies
Sep 1, 2010
I want to call an App function inside a (I know about the Component scope already).What I mean is this:
<mx:Script>
<![CDATA[
public someFunction():void {
[code]......
View 1 Replies
Apr 14, 2012
I am creating a custom component in Flex with extends the BorderContainer class, and I would like to be able to place additional content within the tagset when I use it in my main application, like this:
<components:CustomComponent title="Hello">
<s:Label text="If you have one enter it below:"/>
<mx:Spacer height="15" />
[Code]....
This works just fine, except that my component definition had some additional things inside of it, such as a <s:Label/> and styling, which is replaced by the content within the tagset above when I go to use it.
If I do not put anything within the tagset, the content that was originally in the component is not replaced.
Is there a way that I can simply append additional content inside of the component when I go to use it, instead of it being replaced each time?
View 1 Replies
Dec 21, 2009
How do I say an MXML component is inside some package? Well, it's in a different folder... I know how to do it ActionScript... But when I do in MXML I don't declare the package explicitly because I don't know how, and when I call it to my application, it states that The prefix "package" for element "package:Component" is not bound.
View 2 Replies
Mar 30, 2010
I'm using Flex with Cairngorm framework.I have a custom component which I create like this:
<components:FriendSearchPaginator id="searchResultsPaginator"
paginationElement="{_model.findFriendsPaginationElement}"
visible="{_model.friendsSearchResultsPaginatorVisible}" />
Where the findFriendsPaginationElement is inside the model locator:
public var
[Bindable]
findFriendsPaginationElement:PaginationElement = new PaginationElement();
Inside the custom component I have button that uses a property of findFriendsPaginationElement object:
<s:Button id="previousButton"
label=" prev "
click="paginateSearchResults(false)"
enabled="{_model.findFriendsPaginationElement.more_previous}"/>
But I get a warning from Flex that the binding wouldn't work that way and it doesn't. It works the first time I load up the component but every time I change findFriendsPaginationElement it doesn't reflect on the component. Do you know how I can go about doing this? (making changing a value in the binding variable changes the status of an element inside a component?)
View 1 Replies
Feb 2, 2009
Is it possible to set the height of the sprite depending on the height of an textfield inside that sprite? I'm creating a box with a textfield inside it, but I want the box to be sized depending of how much text it is in the textfield..
View 9 Replies
Aug 19, 2009
I've developed a component which is a combination of a few items (canvas, labels, etc...) but when I try to bind it to a variable such as: {stationXML.getItemAt(1).AAA.@value}, it doesnt work. Before I combined all the items in a component, they were all in the main MXML file at which time they worked. Not sure if it matters, but the "stationXML" arraycollection variable is declared inside the file "Station.as".
View 2 Replies
Feb 17, 2011
I've created a custom component based on Image component. I want to teach it to respond to change of binded variable. E.g. if main class has a variable balance, I want the component to change image in case balance = 100 one image, in case balance = 50 to another.[code]...
View 1 Replies
Mar 4, 2011
I googled for almost a day to find the answer to my question: [URL]. This almost works (and is a great solution), but the solution doesn't work when I do:
1). Copy and paste multiple-line texts.
2). Write long and scroll the texts.
I also found another working example at: [URL]. (The autocomplete prompt appears when you press ctrl+space right at the caret's position). But an email from its author says he uses monotype fonts to calculate individual character's location. Is there a way to get multi-line input from a textfield?
View 1 Replies
Mar 26, 2011
I have the following component in an AIR application from Flex 4:
<mx:HTML id="viewObject"
x="10" y="42" width="634" height="313"
location="http;//localhost:8080/mypage.php" />
Now I want to run a javascript when the page loads but the javascript isn't inside the target page. I want to run the following javascript:
javascript:alert('Hello world.');
I tried approaching it by setting the location property again to the javascript after the page has loaded like below.
<s:Button x="10" y="10" label="Button">
<s:click>
<![CDATA[
[Code]....
Unfortunately for me, that doesn't seem to work.
View 1 Replies
Jun 1, 2010
I have an Item Renderer having HBox. Now I want to add child in that HBox from my application file using addChild method. Any way around for the same. I am not able to access the properties of HBox inside the item renderer.
View 1 Replies
Jun 15, 2010
I have a component in AIR like so:[code]The 2 alerts both work. however nothing happens when you click the new window link.all 3 links works when in a real browser so I know its ok.Is there just no support for window.open in the AIR HTML component? or is this a bug?Is there a work around?
View 2 Replies
Oct 24, 2011
I have a sprite in as3 code, I want to enter its height to resize it, how can I scale the width accordingly?
sprite.height = 200;
sprite.width = ??
View 2 Replies
Jun 21, 2009
I create a simple .As file with following score code:
Code:
package{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.net.URLRequest;
public class AS3_Project1 extends Sprite{
private var sprite:Sprite;
[Code] .....
And the image wont appear but if i remove the sprite.width = 500; line and I can view the image? what going on?
View 3 Replies