Flex :: Play Resize Effect On Parent Before Adding Child To It
Apr 19, 2010
I have a panel with a button in it. Clicking on the button will direct the panel to state "State2" adding another two buttons into the panel. During the state change, I want the panel to resize first and then show the newly added two buttons, so I applied transitions onto the state change.
My question is:
If I put the two buttons within a HBox directly under the addChild tag, it works fine. However, if I create a new component with the same code (HBox with two buttons in it) and then add the new component to the panel (Comp in the code commented), it won't show the resize effect.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
[Code].....
View 1 Replies
Similar Posts:
Jun 6, 2011
i am slightly confused about the parent and child relationship. lets assume we have several different instances, what would be difference of adding them all as children of the stage and creating a parent-child hierarchy between them(other than the access path).
View 5 Replies
Jul 22, 2009
I have a page-like flex application. In my main application is a holder (a canvas) that displays all the pages. The problem is that the components that are loaded inside the holder are bigger than the holder is when the main application starts. The holder height is set to 100% but still he gets scrollbars when I load a bigger component inside of him then himselHow can I solve this problem? And if it isn't solvable would it work correct if I use a viewstack?the holder looks like this:
<mx:canvas height="100%">
</canvas>
But the end of the application is 500 pixels lower so canvas height is 500 pixels high. Now I put a new child inside the holder that is 1000 pixels high.
View 2 Replies
Aug 12, 2010
I'm working on a project for my elementary school students using a book, some mp3s, and some images of text. The main movie clip is called "halloweenWitch" and it's about 10,000 frames long. Every 500 frames or so there's a keyframe for new images of the text. I'm trying to access child movie clips (mc0-mc18) to tween (resize) using code that I found here. [URL] However when I try to access the children with:
Code:
Effects.resizeIt(halloweenWitch.mc0,1,2,2);
From the main timeline I get an error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
When I debugged the program it said that the problem was this line in my Effects.as file.
Code:
targetMC.addEventListener(MouseEvent.ROLL_OVER, resizing,false,0,true);
targetMC.addEventListener(MouseEvent.ROLL_OUT, resizing2,false,0,true);
I think it has something to do with initialization but I'm not sure how to write a function that would tell the stage to wait until all objects inside halloweenWitch are present, nor even if that's what I'm supposed to do.
Code:
targetMC.addEventListener(Event.ADDED_TO_STAGE, init);
??
View 5 Replies
Sep 30, 2011
is it possible to add multiple children(twins) with same instance to add on different parents ?
Here we have an example showing that it fails to perform adding same child (photobg0) with instance on a new parent (page0 and page2).
My primary issue is: if i add too many objects on stage flash starts to lag especially if it is a movieClip from librarery, externaly loaded swf or image files
I am trying to duplicate child objects ,gussing this might prevent lagging?
ActionScript Code:
var request:URLRequest = new URLRequest("images/photobg.swf");
var photobgx:Number = 19.80;
var photobgy:Number = 90.55;
[Code].....
View 2 Replies
Jul 29, 2009
I have Buttons which I have rotated vertically within a Canvas, that is working fine. The problem occurs, when the user resizes the window to a small size a vertical scroll bar appears, I would rather have each button squashed upto a smaller size.
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="40" maxWidth="40" xmlns:myComponents="myComponents.*"
horizontalScrollPolicy="off"
[code].....
View 2 Replies
Dec 8, 2010
I'm having a little issue with the resize event and resize effect of a VBox.
I have something like this:
<mx:VBox id="container"
backgroundColor="0xFFFFFF"
backgroundAlpha=".9"
paddingTop="15"
paddingLeft="15"
[Code]...
View 3 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
Mar 10, 2010
var viewStack:ViewStack = new ViewStack();
viewStack.percentWidth = 100;
viewStack.percentHeight = 100;
[Code]....
Its only displaying canVas3 contents not canVas1 and canVas2
View 1 Replies
Feb 5, 2010
[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]
View 2 Replies
Nov 24, 2011
The name of my DocumentClass is Main. So, what's the difference between :
var myClass:Main = new Main();
var mcInLibrary:MovieClip ;
/////////////////////////////////////////[code]............
View 1 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
Sep 16, 2010
When I'm building an composite animation, I'd like to specify the components as fractions of the parent, like so:
<s:Sequence id="example" duration="2000">
<s:Fade alphaFrom="0" alphaTo="1" duration="10%"/> <!-- not legal -->
<s:Scale scaleXTo="2" scaleYTo="2"/>
[Code]....
Is there a more declarative way to accomplish this? In the latter case, for instance, can I at least replace the variable slideTime with a direct reference to the parent's duration?
View 1 Replies
Aug 15, 2011
how do I get a value from another mxml.I have a vaule in the child mxml that i would like to parse to the parent mxml.Then use the vaule to create a search method.
View 1 Replies
Jun 12, 2010
Is it possible to resize the application at the same moment when the Accordion size change, to make effect resize og the last one synchronised with resize of Application ?
In my code,, the Application is resized after the resize of Accordion is completed:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" minWidth="400" minHeight="300" backgroundColor="white"
[Code]....
View 1 Replies
Jan 3, 2010
I got a "preloader" that creates an movieclip and loads an SWF. Now in the loaded SWF i want a close button to go back to the "preloader". The preloader isn't an actuall preloader but some sort of mainclip.Now i tried this:removeChild(MovieClip(e.currentTarget).parent.pare nt.parent)But i get error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild()at MethodInfo-6()
View 1 Replies
Feb 4, 2010
Recently I worked in a project using Flex. Its a Photo editing project. I have took a Canvas and take a image in that canvas using the code canvas.addChild(image) . Now i can move the image freely by using moving code. The image move inside the canvas and outside the canvas. I want to move the image/child only inside the canvas not outside. How can i do this?
View 1 Replies
Jun 1, 2011
Is it possible to call a child function from within the parent? I know to go child > parent, you can do parentApplication.functionName(parameters);, but what about going the other way... that is parent > child?
View 2 Replies
Jun 7, 2011
I have a main.mxml, child.mxml and headermenu.mxml. I click a button on the headermenu that dispatches an event up to the main.mxml which then executes a method in child.mxml. I know this works because I put an AlertDialog in the function I'm calling inside of the child.mxml. The child.mxml contains a drawingArea object that has an erase(). When I call this directly from child.xml it executes, however if I put drawingArea.erase() inside of the function being called by child's parent (main.mxml) nothing happens.[code]...
View 1 Replies
Nov 23, 2011
i have the following code to play a video stored in the media server:
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[code]......
View 1 Replies
Sep 18, 2010
I have a public variable set within fx:Script tags in a parent component that I'd like to access directly from a child component. How can I do this? I don't want to pass the variable to the child component (I know how to do this and am currently using this approach). Following is a simplified version of the mxml:
Note: SimpleComp is an HBox with a couple of lists.
<mx:Accordion>
<comp:SimpleComp/>
</mx:Accordion>
View 4 Replies
Mar 1, 2011
I have a flex application with two objects: a parent widget (called an IBaseWidget) and a child widget (called a HelperWidget2).When the user clicks on a help link, a helper widget is loaded into the list of base widgets and then displayed for the user.However, when I try to access this child widget by casting the base widget in the collection to the child widget type,the child widget returns null and I am unable to work with the widget.The following snippet correctly returns the widget ID of the newly added widget and dispatches an event to load the widget:
var id:Number = WidgetManager.getInstance().getWidgetId("Helper");
ViewerContainer.dispatchEvent(new AppEvent(AppEvent.WIDGET_RUN, id, openQuickQueryCanvas));[code].........
The problem is that helperWidget above always returns null, meaning the cast isn't successful.
View 1 Replies
Aug 30, 2011
I have many buttons in HBox. Instead of disabling each button, I've disabled HBox. But I am able to click buttons even though the HBox is disabled. Disabling parent component will not make difference on its child? it shows like disabled but mouse events will generate.
View 1 Replies
Mar 29, 2010
I am creating a component that displays a variable amount of "gauges" (square tiles of content if you will), that is laid out like so:
<HDividedBox id="container">
<VBox id="myComponent">
<HBox id="header">
[code]...
View 1 Replies
Oct 2, 2010
I use the addChild(myChild) on a window. but when this window resizes i want to make the myChild width and height to fit the window.
View 1 Replies
Mar 31, 2010
I have an embedded image asset (with a scale9 grid), and I'm trying to get the bitmapdata when it's resized, but I can't seem to do this without adding it to the display list.
I try this:
spriteAsset.setActualSize(w,h);
spriteAsset.width = w;
bmd.draw(spriteAsset);
But when I then draw out the bitmapdata with graphics.beginBitmapFill(), I just get the original un-stretched image.
Or do I need to take 9 separate BitmapData images and make 9 separate bitmap fills?
View 2 Replies
Jul 20, 2009
I have XML that looks like this:
<question>
<type_elt>
<opt_out_flag />
</type_elt>
</question>
type_elt is not an element name; it might be <single>, <multiple> or something else, determined at runtime. How, given this, can I detect the presence of the opt_out_flag element?
I tried this (where xml refers to the question element):
if (xml.*.opt_out_flag) {
do_something();
}
but even in cases without opt_out_flag the above expression returns true. Obviously I'm missing something, but what is it?
View 5 Replies
Sep 11, 2010
if I add a clip to the stage as a child and remove the parent and set the parent equal to null, does the child get collected and removed from memory? What if the child has an image loaded into it as its child?
In my application I'm loading a series of png images as overlays that can be tinted for customizing in this app. When I trace my memory, the basic app idles at 64,000 k. The exact second I load those overlay images it goes up to 205,000k. If I remove those clips and "clear" the stage I should go back down to 64,000 k if everything is removed and collected correctly, right? It's not, it's hanging at 215,000 k. Are my images being cached and that is the reason for the memory staying up? If so, how do I prevent that. Or upon removing the parent of the image how can I un-cache the image.
If a user switches between models and loads several different items then the application actually crashes the Flash environment because of too much memory usage. It also does the same to browsers.
View 29 Replies
Nov 11, 2009
I have a parent swf which loads many child swfs (though only one is displayed at a time). My intention was to use the loaded SWFs document class to retrieve an array of objects to be assigned a tab index, combine this with the parent's own array of objects and apply sequential tab indices to them all. But what happens is actually that the parent's objects are assigned an index, but the external swf is unaffected. In fact, the external swf retains its automatic tab indexing, when I would expect that having set a value for InteractiveObject.tabIndex, automatic tab indexing would be disabled.
I've seen similar tales elsewhere. Most posts I've read are wanting to load an external swf, give it focus and loop through those objects, then close the swf and return to looping through the parent. However I would like loop through all objects as one. including manipulating the focus manager(s), and basically fiddling with every tab-related property I know.
View 2 Replies