ActionScript 3.0 :: Expanding Width Of TLFTextField When Parent Container Resized
Apr 7, 2011
I have spent nearly a day on this now, searching everywhere, but never found anything. This is my desperate attempt to get my problem solved. I have a container (ContentHolder extends Sprite), which holds another container (Content extends Sprite) which has a TLFTextfield in it.
Now when I resize the ContentHolder, its children get resized too. I have overridden set width and set height in the Content class, because I need the Content to resize differently than just scale. I want the TLFTextfield width to adjust to ContentHolder width, while maintaining font size. So ideally the TLFTextfield would set different line breaks, according to the width of ContentHolder.
I really have no idea how this can be achieved. One solution may be to create a new TLFTextfield instance with the updated height and width values, but that could look messy when drag-resizing the ContentHolder..
View 3 Replies
Similar Posts:
Feb 17, 2010
On the stage I have a movieclip (Container, originally 200px width) and inside it with a progressbar movieclip (originally 700px width), scaled with Free Transform Tool to fit the parent container. The width of the container changes run-time while resizing the scene.
In ActionScript I have a function which should set the progress bar width according to a calculated percentage value:
private function updateProgress(event:TimerEvent):void
{
var barWidth:int = _container.width;
var progress:Number = _stream.time / _stream.duration * barWidth;
_progressBar.width = progress;
}
My problem is that the progressBar even at full time (100%) is only at 1/4 of the parent container. I assume that it comes from the symbols original size.
Can I correct this programatically, or I must redesign it with the "designer"?
View 2 Replies
Oct 25, 2011
I'm using flash cs5.5 and usually when i make a text field, the text is cut off by the width of the text field unless i autosize it, but with TLFTextField, it just resizes itself without me telling it to. How do i set the TLFTextField so that the text stays within a certain width and crops everything past that width?
View 2 Replies
Jul 2, 2011
In a Flex Mobile project I have a simple itemRenderer where I'm trying to create an "bubble" texting effect, similar to ichat or iphone (just so you get what im going for). But if the text is longer than the screen it runs off, rather than just going down a line.
If I set Group thats holding the rectangle(to create the bubble effect) and the label to 100% it works and keeps it from exceeding the list containers bounds, BUT the group is always at 100% and looks bad, I'm trying to keep the "bubble" JUST AROUND the text.
Anyway so, at the top of my itemRenderer I tried specifying:
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%">
And here's my layout I figured since msg_container has a width of 100% I was hoping bubble_lable_group would just not exceed that but...it doesnt...it just runs off. I tried setting a max width but that does not allow you to input percents. And just to say it 1 more time. I know if i set bubble_lable_group width to 100% it works, and keeps it from going off the edge, but then the rectangle "bubble" stretches all the way across and just looks bad.
<s:VGroup id="main_container" horizontalAlign="left" paddingBottom="10" paddingTop="10"
verticalAlign="top" width="100%">
[Code]....
View 1 Replies
Feb 2, 2010
I have a flash within a holder div (flash container). I use swfobject to insert the flash object (if it makes any difference). I want to resize that holder div to make it smaller in width, when I achieve the "second level" in my "flash application". (with jQuery .animate() function). What "flash application" mean: I have a human body on wich I can click in different body areas. That is the first action - and the effect is to zoom onto that specific area of the body.
Then I can click again on a more specific zone into that area - and the effect consists in fetching some stuff via ajax. (it's some medical stuff, diseases etc.) - that's the "second level" in my "flash application". Then I can click on that stuff fetched via ajax - that's when I resize the flash holder. The problem is that, because of this resizing, my flash reloads and comes back to it's original state, without that zoom level. This reload appears in the "second level", and not when I click on the stuff fetched via ajax and the flash holder resizes. But that's the cause of the reload, because without this resizing, it's all ok. The problem is just in Firefox, I tested it in IE6,7,8, Opera 10, Safari latest and Chrome and there's nothing wrong there, the flash does not realod. Hope you understand what I'm saying here :) if not I cand send you a private message with the URL to see what I mean (I can't make it public)
View 2 Replies
Aug 13, 2010
I have a group for which I want to enable horizontal scrolling. Vertically the group should be as wide as possible (100%).
[Code]...
Now if I start the application the MyComp-component is about 200px wide and starts to expand its width to infinity. This is like some transition or animation and I don't know how to stop it. Setting something like maxWidth would solve the issue, but I don't want to set explicit values.
View 1 Replies
Jul 29, 2011
I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.[code]Sprite2 is a rectangle. When I rotate it, of course, the height of its parent, SpriteP, GROWS. But I would expect that height to go back to what it should be when I'm removing Sprite2!And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200.
View 10 Replies
Jul 29, 2011
I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.
When Sprite2 is NOT rotated:
Code:
trace(SpriteP.width + ' ' + SpriteP.height); //100 250.
SpriteP.removeChild(Sprite2)
trace(SpriteP.width + ' ' + SpriteP.height); //100 200. -> works, 200 is good.
When Sprite2 is rotated at 90:
[Code].....
And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200. But if I rotate Sprite2, the Parent won't update its bounds.
View 1 Replies
Apr 13, 2009
Line 1 Frame 1:
[Code]...
I am trying to trace the results of my listener when the browser is resized...no avail. Are you able to see what I am doing wrong?
View 1 Replies
Aug 26, 2005
I have a root folder that calls a container loading movie-a. The problem is that this movie-a has a red symbol that scrolls from the outside to the inside of the movie. If I loaded the movie-a by itself it wouldn't show the symbol outside but as this is inside a root... well... it shows (see image). Is there a way to set container width-height? I know I can mask it but I don't want to to that because I have other symbols flying around the movie.
View 11 Replies
Jul 30, 2004
how i would create a mc container with positioning and width and heigth?
var mc = _root.createEmptyMovieClip("photocontainer", 1);
mc._x = 3;
mc._y = 30.5;
mc.width = 440;
mc.height = 345;
View 1 Replies
Jan 11, 2008
I have 3 SWFs.
X.SWF - Parent application. Contains an empty movie clip for loading external swfs using loadClip() method.
B.SWF - Has some text and pics. Gets loaded into the empty movieclip on X.SWF. Also has a button saying 'Load A.SWF'.
A.SWF - Similar to B.SWF with a button saying 'Load B.SWF'.
When I start the main application (X.SWF) and load B.SWF into it all is fine. But would like to click on the 'Load A.SWF' button on B.SWF and load A.SWF into X.SWF. And visa-versa. The problem is I'm not able to refer to the parent container (X) from these child (A and B) SWFs.
View 1 Replies
Sep 16, 2008
Late night dumb question time:I have an SWF named "gallery.swf" that loads into an empty clip called "holder_mc" in the parent movie. How do I call a function from gallery.swf that replaces gallery.swf with a file called "purchase.swf" in holder_mc? The function I'm using looks like this:
Code:
function ProceedToCart():Void {
_root.mcLoader.loadClip("purchase.swf",_root.holder_mc);
[code].....
View 1 Replies
Feb 27, 2011
I know this might seem like such an easy issue and I can't understand why I cant figure it out but none the less I can't and I've just about given up. Here's the issue:
I have a sprite container which is supposed to hold a bunch of thumbnails to videos. I am able to populate the container with all the videos and the whole works but obviously if I add a bunch of videos its going to exceed the size of the flash document so I need to add a UIScrollBar (which I did) now the scrollbars target is set to the container but isnt allowing me to scroll and if im correct this is because the container doesnt have a set height. So Im trying to set the height of this container but the second I try setting the height or even width all my thumbnails I used to be able to see are gone! It's as if the size is being set to 0 when its not I've even tried to set it to a specified size just to test and nothing.
[Code]...
View 1 Replies
May 26, 2011
I've got a container(sprite) with children(sprites) added to it. When I scale the container, I would like to get the new width of a child, but when I trace the children's width I always get the original dimensions, even though everything gets visually scaled as it should. How do I overwrite the children-width ?
Update: I just found out that the children.graphics-"dimensions" could have caused the problem. When I leave the graphics, everything seems ok. Is it possible to scale the graphics at same time as the child-sprite?
View 3 Replies
Jul 22, 2011
Using Flex 4 AIR, what is the maximum widtha and height I can set for line and the bordercontainer?
bc:borderContainer = new borderContainer();
bc.width = 80000;
bc.height = 80000;
View 1 Replies
Jul 30, 2004
is this how i would create a mc container with positioning and width and height?
var mc = _root.createEmptyMovieClip("photocontainer", 1);
mc._x = 3;
mc._y = 30.5;
mc.width = 440;
mc.height = 345;
View 1 Replies
May 14, 2009
i'm a designer trying to step up my flash skills and have a scripting problem that's causing me trouble. essentially i have a child swf loaded into a container in a parent swf and want the child to be able to instruct the parent. to explain in full, the child contains an flv with bespoke video player components. it's container sits in one frame of the parent. when the flv finishes playing, i need the parent swf to move onto another frame.
as it's a controllable flv, it isnt possible to predict the exact length of time the child will need to be present, so it literally needs to tell the parent it's finished playing at that very point.
[Code]...
View 9 Replies
Nov 22, 2010
I have a canvas onto which I draw shapes like rectangle etc. When I move the shape using my custom mouse down/mouse move handler, the shape can go outside the parent bounds.
I am checking if the child is outside the parent's bound to snap it back:
var bounds:Rectangle = this.getBounds(this.parent);
var p:Point;
if (bounds.x <0) {
[Code]...
The snapInside method gets called when I go outside the left or top boundary. But when the child is dragged outside the right or bottom boundary, I find Flex/Flash runtime automatically expands the parent's height and width. So say the parent size was initially 800x600, if child Y bounds exceed 800 by say 20 pixel, I find the this.parent.height automatically resized by flex to 820!!
How do I prevent the parent from resizing when child goes outside the original bounds of the parent ?
View 1 Replies
Jul 5, 2011
is it possible to retrieve all children of a certain type from a parent in actionscript 3? i only see getChildAt,getChildByName, is there a getchild of a certain type like get all childs of object type:Food?
View 2 Replies
Jun 1, 2010
Embedded some characters using embed tag in flash CS3 (font.swf). 2 separate swf (a.swf,b.swf) loads the font.swf on runtime. These 2 swf are being called from a container (parent) swf. It looks find locally and not time consuming to load. But when I view it from a server, computer lags after a while....
(all file sizes are relatively small.around 160kb)
What needs to be done in order to prevent computer from lagging? Is it better to load font.swf not in separate swf but directly in container(parent).swf?
View 0 Replies
Mar 9, 2010
I am trying to load a swf(as3) into another As3 Swf with the Movieclip loader. After loading however Loader.width/loader.content.width returns an exaggerated value than the actual width of the swf being loaded. Any pointers on where to begin looking for the discrepancy?
More Details (if it helps)
The swf being loaded has UI components like dropdowns, input boxes and combo boxes (its a Form to fill up), and a coded one-time tween. When the child MC loads into the parent movieclip, the Loader.width value returned is exaggerated by about 28 pixels (although the height remains the same). Loader.content.width also returns a 28 pixel exaggerated value. The Exaggerated value is more than even the stage width of the child MC. The extra ~30 px are upsetting subsequent code in the parent movie to scale and center the loaded swf.
update:
stage.stageWidth returns the correct Value.Code used in the parent MC, to load external SWF:
private var deadURL = "child.swf";
private var deadReq:URLRequest = new URLRequest(deadURL);
private var deadLoader:Loader = new Loader();[code].....
View 2 Replies
Nov 30, 2010
I've got the following situation, where I have an outer Vbox that is set at a fixed width, and then inside it there is a header made from an HBox and a content area (Canvas) that is much wider than the enclosing VBox (and therefore requires scrollbars on the outer VBox to see it all).
I would like to set the width of the header to fill the entire width of the outer container, but only the visible part, and to remain fixed so that when I scroll to view the content, the header doesn't move.
[Code]...
View 3 Replies
Feb 15, 2009
I have a container object that i add children to. I want to change the height & width of the container without the children scaling. In this case I draw a rectangle in flash which I'll use as the container object then export for AS.
[Code]...
View 5 Replies
Feb 11, 2010
Is there an easy way to make a parent container (eg Group) resize when it's children resize?
Below is a little example app. When I put the 200x200 'food' in the 'stomach' the stomach & it's containing 100x100 'body' should resize to contain the food.
[URL]
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code]....
View 2 Replies
May 13, 2011
I have code like the following:
<s:VGroup gap="10" id="group" height="100%">
<s:Label text="This is page 2" />
<s:Button content="Resize Canvas" click="resize(event);"/>
<mx:Canvas id="photoCanvas" color="#567898" backgroundColor="#125567">
</mx:Canvas>
</s:VGroup>
I don't understand why the following does not work:
Pushing the Button resizes the photoCanvas's height (gets taller or smaller). Since the photoCanvas control is a child element of the VGroup shouldn't the container update itself to the new height? The Vgroup has ALWAYS the same height, no matter what the (total) height of the children is! I would like the VGroup to adjust itself and get a height value equal to the sum of its children heights. Is this not possible??
View 1 Replies
Mar 11, 2011
How can I limit the size of a child container with percentage width/height of 100%?
Example:
<mx:HBox id="container" width="100%" height="100%">
<mx:HBox id="scrollContainer" width="100%" height="100%">
<!-- keep this content limited to the size of "container" -->
[Code]....
Apparently I can get the desired behavior if I change HBox to Canvas but I would still like to know how to accomplish this with a HBox and why it differs from Canvas.
View 3 Replies
Sep 28, 2010
how I can target the parent container of whichever object receives an event?
Code:
Parent1.btnA.addEventListener(MouseEvent.CLICK, doSomething);
Parent2.btnA.addEventListener(MouseEvent.CLICK, doSomething);
Parent3.btnA.addEventListener(MouseEvent.CLICK, doSomething);
[Code].....
View 1 Replies
Oct 20, 2009
Having some strange problem getting a width from objects placed on stage using addChild. I am under the assumption that when I add some children to a specific parent, the parents width will increase and I can use that number to immediately act on the parent. The width is 100 when traced no matter when or where I add the children. I can change it statically but the is a desktop app which depends on screen size.[code]
View 1 Replies
Feb 13, 2010
i have a swf (child swf) which is loaded into another swf (parent swf). I want the child swf to know the stage.width of the parent swf. If I trace "_parent.stage.width." I get output undefined. Is there a way to do this?
View 3 Replies