Flex :: How To Get Size / Coordinates Of Content Area Of Container Objects

Jul 21, 2010

How do I get the size of the content area of Container objects? One non generic solution is checking for styles I suppose but I am looking for some code that works generic for all standard flex Container objects. The controls are Flex 3

View 1 Replies


Similar Posts:


Actionscript 3 :: Getting Size/Coordinates From Loader Content?

Mar 23, 2010

i'm attempting to position a textfield to the bottom left of an image that is added to the display list from the Loader() class. i don't know how to access the width/height information of the image.

var dragSprite:Sprite = new Sprite();
this.addChild(dragSprite);
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest("picture.jpg"));

[code]....

within the displayPic function, i could assign the evt.target.content.height and evt.target.content.width to variables that i could use to position the text field?

View 1 Replies

ActionScript 2.0 :: Building A Dynamic Content Page In Flash That Consists Of Using AttachMovieClip And CreateEmptyMovieClip With Coordinates To Place Photos And Objects

Oct 15, 2006

I'm building a dynamic content page in flash that consists of using attachMovieClip and createEmptyMovieClip with coordinates to place photos and objects, which are loaded from an external source and scrolling their thumbnails I've run into a problem setting the variables correctly because the scrolling thumbnails required that the thumbnails be nested inside a scrolling controller clip and that has somehow messed up my preloading and sequential text caption loading for the tumbnails.

View 4 Replies

Flex :: Getting The Global Coordinates Of The Visible Area Of A Component?

Oct 19, 2010

I am trying to determine the global coordinates of the visible rectangle that is currently rendered on the stage.

Specifically, if a canvas has an explicit height and width and is a child of a panel that has a scrollbar, the scrollbar can "hide" a part of the canvas. ContentToGlobal(x,y) provides the global position of the content at the time, but content coordinates can scroll off the boundaries of the parent panel and continue to give x,y coordinates that are not visible.

Is there a way to determine the viewable rectangle that is not hidden by anything?

View 2 Replies

Flex :: Layout: Can Width Be 100% Of The *visible* Area Of A Larger Container?

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

Flex :: Hide (not Remove) The Content Of A Panel Container?

Dec 4, 2009

I'm extending a Panel to build a custom component. Without knowing what this will contain later, how can I add a method to temporarily hide all contents and displaying an internal object (which is normally invisible) instead?

[Code]...

View 2 Replies

Flex :: Setting Content Area In Custom Component?

Dec 11, 2009

I am trying to define the content area of a custom component that extends mx:VBox. The component has predefined headers and footers (visual children) and I want to set the area in the middle for adding children to the component. The component will be used like this:

<custom_component>
<mx:button/>
</custom_component>

How would I set this content area?

View 3 Replies

Flex :: Change Size Of An HBox In Flex To Fit It's Container?

Jul 28, 2010

I create an HBox, fill it with a grid of buttons, and set the scroll policy. When I resize the window, the stage changes size, and so does the HBox ... to a point. Once it reaches the height of the Grid it contains, it stops shrinking, like it has a "min-height". This ruins the scrollbar that I'm trying to establish in this case.

I've set the height to 100%, shouldn't it always take the height of the stage, it's parent?[code]....

View 2 Replies

Flex :: Make A Container Resize Based On The Size Of Its Contents?

Mar 16, 2010

I'm trying to create a Flex application that can automatically shrink based on the size of the components that it contains, so that a user can shrink it to a minimal view to see more of the HTML page it's embedded in.

I know how to change the size of the whole application using ExternalInterface, but I'm having trouble automatically figuring out how much the size changed when something is hidden or shown.

For example:

Let's say I have the following flex layout:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:VBox width="100%" paddingTop="0" paddingBottom="0"

[Code]....

How can I hide one of the text fields and cause the VBox to shrink? I'm currently setting it to visible = false, but that doesn't seem to affect the parent VBox.

Once the VBox shrinks, how can I detect that the Application no longer needs so much space, and then go about figuring out how much less space it needs?

I've tried using ResizeEvent, but I haven't been able to get them to work, but I could be doing something wrong.

View 1 Replies

Flex :: Drag - Change The Size Of Container With Mouse Dragging?

Dec 21, 2011

When you drag the edge of container with mouse ,how to implement changing the size of container?

View 1 Replies

Actionscript 3 :: Adobe Flex - Way To Automatically Change Font Size To Fit In Its Container?

Sep 8, 2009

I have a component in Flex, and part of that component is a label. Is there a way to automatically adjust the font size to fit into its container?

View 1 Replies

Flex :: Limit The Size Of A Child Container With Percentage Width/height Of 100%?

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

Actionscript :: Collapsible Flex Container That Can Handle Dynamic Content That Works When Pre-collapsed?

Feb 2, 2011

Do you know any collapsible flex container that can handle dynamic content that works when pre-collapsed? I tried the CollapsiblePanel component by Arc90 for Flex, but it did not work when pre-collapsed.If I have a VBox inside the panel, and I set the "collapsed" property of the CollapsiblePanel to true, the size of the CollapsiblePanel cannot be restored. It seems like this is what is happening:

The CollapsiblePanel's collapsed property is pre-set to true in the MXML markup.

The VBox auto-adjusts its height to 0 since the CollapsiblePanel is collapsed.

When the CollapsiblePanel's collapsed property changes to false (i.e., it is expanded by the user), the VBox does not expand itself because its parent's content area is 0. Therefore the CollapsiblePanel remains at the same height because its content's height is 0.

Note: This occurs only when the CollapsiblePanel is pre-collapsed, as seen in the markup below.I've already tried this (didn't work):

<containers:CollapsiblePanel minimize="pnl_minimize(event)"
restore="pnl_restore(event)" height="100%" width="100%" collapsed="true">
<mx:VBox width="100%" height="100%" verticalGap="0">[code]....

View 1 Replies

ActionScript 3.0 :: Conversion Between Container Coordinates?

Nov 10, 2010

This is a mockup of my swf: It's just a menu and a sprite named scene (which is a container for obj1 and obj2 and it's child obj3).The obj1 and obj3 are draggable. While dragging them the MouseEvent.MOUSE_MOVE is fired and in it's event handler I'm updating a textfield with the object's coordinates relative to the scene object:

private function onMouseMove(e:MouseEvent):void {
myTextfield.text = "x:"+ objectBeingDragged.x + " y:" + objectBeingDragged.y;
}

When I move obj1 I have no problems because it's parent is scene and the coordinates I want are the coordinates relative to scene. But when I try to move.obj3 I'm getting the coordinates relative to it's parent (obj2) and I want the coordinates of obj3 relative to scene.I tried to convert the objectBeingDragged coordinates to global and then to local but I had no success...

private function onMouseMove(e:MouseEvent):void {
var localPoint:Point = new Point(objectBeingDragged.x, objectBeingDragged.y);
var globalPoint:Point = objectBeingDragged.localToGlobal(localPoint);[code].....

View 1 Replies

Flex :: Detecting The Size Of SWFLoader Content?

Sep 23, 2009

I want to load in a SWF and set it to fit in the window, whilst keeping it's aspect ratio.When I do this by setting the height and width of the SWFLoader, the SWF will resize to best fit in the space (as it is keeping it's aspect ratio).However I can't find a way to detect the height and width of that SWF now it has been resized. The size of the SWFLoader reflects what I set it to, and the SWFLoader.LoaderInfo size seems to be totally random.

I have also tried the loaderInfo.content, but again I don't get a value that compares to the size of the SWF I have loaded (or at lease the size of what is visible).The only thing I can think to do is to know the height and width before and then figure out the aspect ratio, so if I resize the width to 50% of the window, I can do the maths on the height to make the swf loader the same height as it's scaled content.

View 1 Replies

Actionscript 3 :: Generate Random Coordinates From Area Outside Of A Rectangle?

Apr 29, 2010

I'm working on a simple tutorial, and I'd like to randomly generate the positions of the red and green boxes in the accompanying images anywhere inside the dark gray area, but not in the white area. Are there any particularly elegant algorithms to do this? There are some hackish ideas I have that are really simple (continue to generate while the coordinates are not outside the inside rectangle, etc.)

View 2 Replies

Flex :: Locate And Size Objects Relatively On The Screen?

Jan 7, 2011

I want users to be able to locate objects ,say rectangles, freely on the screen. Each Rectangle will have width, height, x, y.

I want that when users resize browser window, the rectangles change location and size relative to the window while maintaining proportion.

I noticed I could do something width="20%" height="20%" and then object will resize but if the aspect ration is diffenent the rectangles will look distorted. Also I wasn't sure what's the best way to locate object relatively as I noticed I couldn't bind Flexglobals.toplevelapplication.width/Flexglobals.toplevelapplication.height to x/y.

View 1 Replies

Actionscript 3 :: Convert Global Coordinates To Local Coordinates Of A UIComplenent In Flex Project?

Dec 19, 2011

I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point

uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue

var lp:Point = new Point(e.localX,e.localY);

I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2

var lp2:Point = new Point(e.localX,e.localY);

now surprisingly it was giving correct values as expected and I went back and changed the code as

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);

now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.

View 1 Replies

ActionScript 2.0 :: Movie To Stop At The Current Frame Whenever Click And Hold The Mouse Down Within The Area Of The Container?

May 4, 2005

I was certain that this type of problem would have been previously discussed here or in a tutorial. I have looked quite a bit and could not find anything that puts all the pieces of my puzzle together.As the movie is playing (looping), I would like the movie to stop at the current frame whenever I click and hold the mouse down within the area of the container. Furthermore, I would like to be able to scrub the movie backward if I drag my mouse to the left within the container and as I reach the left end of the container, the movie is at the first frame. And similarly, I would like to scrub forward if I drag to the right within the container and as I reach the right end of the container, the movie is at the last frame. On top of this daunting task, I would like the movie to resume playing from wherever I have released the mouse.

Here is a file that I have started and I am pretty much at a loss as to where to go now. I know it has something to do with where the mouse is relative to either side of the container, but...how does one get it to work?Basically, I would like to emulate the functionality of the QuickTime Player - the one where you can grab the slider and drag it left or right to scrub in either direction and then upon release of the slider it resumes playing.I do not understand the media components in MX 2004, maybe this type of thing is "easy" to program in to one of those modules?

View 1 Replies

Flex :: Prevent Container In ItemRenderer From Exceeding Width Of List Container?

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

ActionScript 3.0 :: Capturing X,y Coordinates For Two Objects?

Mar 29, 2010

I have two columns of objects on stage, one on the left side column (A) and one on the right side (column B). Each column has 3 objects in it. For this quiz I want the user to be able to draw a line from each object in column A to the corresponding object in column B.To do this I need to capture the xy coordinates of the first object that the user clicks on and then capture the coordinates of the 2nd object the user clicks on so that I can draw a line between the two of them. Drawing the line is no problem but how do I capture the coordinates of the first object selected and then the 2nd object selected? This is as far as I've got with the code.

var clip:Shape = new Shape()
var startX=0
var startY=0

[code]....

View 1 Replies

ActionScript 3.0 :: Moving Objects Using X,y Coordinates?

Jun 23, 2009

I have a MovieClip on my stage. Inside the MovieClip there are a few buttons (all MovieClips also) and a mask layer to keep anything on the outside invisible.

Problem: My MouseEvent fires and should move objectA into position over objectB. All code in the script tells me it has moved. Tracing the x,y coordinates of objectA also tells me it has moved. The Alpha on objectA is 100% and it is positioned on the topmost layer beneath the mask layer. All this tells me that when the object moves, it should be visible on the stage (the event moves the object into the masked area). Testing disproves everything. The traces all tell me the object is where it is supposed to be but it cannot be seen. I don't understand this and it, amongst other AS3 hiccups, is seriously turning me off Flash as it seems to be a waste of time to try and learn as it seems like 90% of the scripts written will fail 90% of the time.

View 3 Replies

ActionScript 3.0 :: Get Objects Absolute Coordinates?

Oct 2, 2010

My stage contains an object that contains a child. The child sees it's x and y position in relation to it's parent, so when the object moves, the coordinates remain the same.

How do i get a child's coordinates relative to the stage?

View 3 Replies

ActionScript 3.0 :: Finding Coordinates With 2 Objects

Nov 30, 2009

I get the feeling the title is misleading... What I try to achieve is quite simple (at least it sounds like a simple thing to do). I am trying to find the intersection of 2 objects in relation to each other. One of them is the character for my game, and the other is the obstacle (the floor, a barrel, etc). I need to find the coordinates of the character in relation to the obstacle. Here's a picture to make it a bit clearer:

Here the coordinates (and the cross) represent the origin of my objects, and the two squares are my character (twice to better represent the multiple possibilities). The number after the slash for the square is what I should get as the .x when my character hits the obstacle. I tried using getBounds(), but I really don't know about it and tried stuff based on the little knowledge I have about it (I won't post the code here, first it was horrible, and it also didn't survive the rage I had trying to get this to work...).

[Code]...

View 4 Replies

Actionscript 3 :: Showing An Objects Coordinates On Stage?

Oct 22, 2011

I need to show a an objects coordinates on stage as it moves across the screen.

View 2 Replies

ActionScript 3.0 :: Showing An Objects Coordinates On Stage?

Oct 22, 2011

I need to show a an objects coordinates on stage as it moves across the screen.

View 2 Replies

Flex :: Dynamically Adding Container To A Dynamic Container

Sep 21, 2011

I have a loop that goes through data from a book and displays it. The book is not consistent in it's layout so I am trying to display it in two different ways. First way(works fine) is to load the text from that section in to a panel and display it. The second way is to create a new panel (panel creates fine) and then add collapsable panels(nested) to that panel. Here is the code from the else loop.

else if (newPanel == false){
// simpleData is just for the title bar of the new panel
// otherwise the panel has no content

[Code]....

The error I get is: ReferenceError: Error #1069: Property panel4.4 not found on components.readTest and there is no default value.

I have tried setting the "name" property instead of the "id" property.

View 1 Replies

Do Not Allow Editing At Specific Area In Text Area In Flex

Nov 10, 2011

I just want to do not allow editing at some area of text area in flex. How it can be done?let suppose text length in text area is 50 characters, i want to allow editing if cursor position is less than 15, and if cursor position in text area is greater than 15 it should not allow user to add more text in text area.If user press any key it should not add any character in text area.[code]

View 1 Replies

ActionScript 3.0 :: Resize Container's Content To Fit?

Apr 14, 2011

I have a stage with Top, Middle & Bottom Movieclip's set on it. On resize the content is scaled to fit and maintain the correct proportions.I am loading each content (page) in as external SWF files into the Middle container using a Loader and URLRequest.Here is my onCompleteHandler function:

Actionscript Code:
function onCompleteHandler(loadEvent:Event){ // Remove Preloader  middle.removeChild(preload);  content =

[code].....

View 2 Replies

Actionscript 3 :: Finding Out Coordinates Of Drawn Objects In Flash?

Jan 6, 2010

I'm in the process of making a board game in Flash; as part of process of getting fully to grips with Flash AS3.

I have a JPEG of the original board. This contains ~ 1000 circles that players may move pieces between. Pretty standard board-game stuff. The circles are not in any way regularly spaced.

So far, I've drawn the circles in Flash, by hand, and positioned them where they need to be. This looks great - I can see all my places.

What I want to do now is create these circles programatically. I want to be able to do this so I can adjust how the spaces look (depending on game state). Eventually I'll want to be able to zoom / pan the entire game board as well.

My question is, is there a way of tagging each circle with a unique reference and then looping through and recording locations?

I'm thinking something a bit like the Javascript DOM "getElementsByTagName" or similar.

At the moment I can only see two options:

Convert each circle to a symbol and give it a unique class name so I can access it from code Go through and write down the X/Y of each circle (add to my DB of board locations that I already have) so I can plot them programatically

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved