AS3 :: Change X Value Of A Parent Doesn't Apply X-change To Its Children?
Dec 12, 2010
So basically I have a class which adds items and needs a drag and drop. I change the x value of the entire contianer class simply by this.x = something
By drag and drop all the items slide across the screen. When I trace the x value of the container class it has changed, but the x value of the items stayed the same (although their x value on the screen definitely changed).
View 1 Replies
Similar Posts:
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
Jul 19, 2011
I have placed 3 movieclips named mcParent, mcChild1, mcChild2 and 1 textbox in flash. child are childrens of parent movie clip. child1 and child2 both are of sizes 300 whereas parent movieclip is 600px, textbox is placed inside child2 movie clip .
I have made the flash to auto resize according to the screen area. Everything works well, but after resize it resizes parent and all childrens and textbox which is correct. The problem is with the correct placement of textbox on mcChild2. I have seen that after resize, mcParent width and scalex both changes but the child clips doesn't changed its sizes even they are stretched but there sizes are not updated due to which I am unable to get the exact location of where to place the textbox.
View 1 Replies
Nov 23, 2010
I have created a custom component - MyImage - that has two children including a Bitmap as well as a Sprite.My display object hierarchy is as follows -
mx:Canvas
view:MyImage
mx:Bitmap
[code].....
View 1 Replies
Apr 15, 2011
i have 3 mc's on stage and several buttons to change the color of a mc. can i apply the color change to one of the 3 mc's by selecting it?
example: i click on the triangle to select an then go to the color buttons and click to change the color, but if i select the square and then click on the color button it will change the square color....
View 3 Replies
Aug 21, 2011
I have Flash CS5 and cannot get the pencil or in k tool to change color it stays at the layer color only. When I make a shape and pick paint bucket tool it will not add the color I am choosing.
View 1 Replies
Nov 30, 2009
I'm building an Xml-driven application. I create new states in a separate actionscript-class.These states all contain a DataGrid. I can switch the states in the Main.mxml.
But now I would like to access certain children of the DataGrid. In this case I would like to toggle the visibility of GridItems, from a Button in the Main.mxml.
How do I have access and apply this to the already created states ? I tried to create RemoveChilds and override/push it to the state.All I archieved was to remove an entire GridRow at the very last state, but it should be just one GridItem at every state.
View 2 Replies
Jan 5, 2012
[Code]....
I am currently updating page level "visited=true" programatically/runtime. I wanted to roll up to topic level(all parent levels) once I have shown visited state "true" to all pages in topic.
View 2 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
Oct 17, 2009
I am loading in some images and adding them to a movie using: mc.addChild(imageLoader); once all the images have been loaded in , i want to alternate the order of the children, so a different child is in the front and in view. i have been reading up a little on it and it seems the example i find are changing the order of different mc's . whereas i have 1 mc and im trying to change the order of its children.
View 1 Replies
Nov 30, 2009
I want to detach a movieclip and attach it elsewhere, but it doesn't seem possible in AS2.
I'm looking for an AS2 equivalent of Cocoa's addSubview/removeFromSuperview.
Is there alternatives routes to go, such as duplicating a movie with a new parent.. is that possible?
View 1 Replies
Oct 20, 2009
I'm trying to do a cross-fade effect for my gallery. To do that, I'm using two movieclips, one that holds the image currently displayed, and another one that holds the image that should be displayed next. When the coming image is loaded, the cross-fade effect should happen, the container that holds the image that was on stage should be cleared out, then the image in the other container should be displaced to the former container. I'm almost there now, but I got stuck at the last part. Here's my code so far[code]...
View 2 Replies
Oct 18, 2009
In flash if I change scale of parent movieclip, scale of all child inside the parent was changed too. Now I look for the best way to fix child scale while parent scale is changing. I mean the way with minimum listener and cpu usage. In my project I have a map (as parent) and many icons on map (as childs). map has zoom in and zoom out button and pan while dragging.
View 2 Replies
Nov 18, 2003
If you put a button symbol into a movie clip. Then, place the movie clip onto the main time line. Add multiple scenes to the movie and multiple frames on the pain timeline. Go back to the button within the movie clip and program it
[Code]...
View 14 Replies
Nov 4, 2005
got a bit of a tricky one here [well, it could be an easy one, but I have no idea where to start on this one]
Lets say I have two objects on a stage, one named mcA and mcB, within mcA I have another object [called subA] which contains a few small objects, a AS class and some other stuff like components etc...
Is there a way for me to replicate that exact object [subA] inside mcB without loosing any data and such? is this posible?
So basically I want to make a copyClip function, that has the ability to copy/move objects from one object/clip to another...
View 3 Replies
Jul 1, 2008
How can I change what movie clip an object is contained in after it has been added to the stage? I want a movie clip to start out in the main stage but them move into another movie clip so that when I move the containing movie clip the sub clip moves as well.
View 1 Replies
Oct 22, 2009
I'm working on a project and I need to be able to change the movieclips parent without moving the child, so I can tween it into position myself.
View 7 Replies
Jun 29, 2010
I've been trying to use the object.watch() method. I've never used this before, so I'm assuming I'm pretty far off base here. What I have is a parent movie (_root.) that has a bunch of variables. As the user progresses through the movie/project the variables change based on the user's actions. Within this parent movie there is another movie embedded. In this movie, things change based on the variable changes of the parent movie. So, for instance, say the user gets through frame #20 and hits the "next" button in the parent movie, this triggers a variable change in the parent movie, which then causes the embedded movie to change its color from blue to red (or whatever, action doesn't matter)
[Code]....
View 1 Replies
Mar 6, 2010
I want to change a variable set to 0 in the parent to 1 when a button in the child is clicked.
This is the parent zero.swf:
var noPass:Number=0;
function getPass(event:onLoad, noPass):void {
if(noPass==0) {
[Code]....
View 1 Replies
Oct 20, 2009
I expected the trace command at the end of this code to return 0, but it returns 100. Does anyone know why mc's y coordinate value is not updated after adding it a child?[code]...
View 9 Replies
Jun 14, 2010
A component in my main project has 2 states. I want to change the component's state when the mouse is over the Parent.
View 2 Replies
Mar 28, 2011
I have a custom component ExpandCollapseMenu that extends SkinnableContainer.This component can have state "normal" or "expanded".Inside this component I have buttons, with different skin based on ExpandCollapseMenu's state.This works fine when defining the buttons inside ExpandCollapsMenu's skin class:
<s:Group id="contentGroup" top="20" left="10" right="10" bottom="10">
<s:layout>
<s:VerticalLayout/>
</s:layout>
[code]....
View 1 Replies
Jan 7, 2010
in Document Class action script file I have the following variable
Code: Select allvar ballPointRight = new BallPointRight(ball,xDir,padScreen);
And then in BallPointRight action script file which is linked with BallPointRight movie clip I have the following code
Code: Select allpackage {
import flash.display.MovieClip;[code]...
So the line xDir = -1; doesn't change variable located in Document Class action script file even if if sentence is true... Is it maybe because it's number?
View 3 Replies
Apr 2, 2010
I made a new symbol. The symbol name is button. And it's text is "Start Generator" - So this code:[code]Doesn't seem to change the text of the button to "You clicked it"
View 4 Replies
Jan 31, 2006
I have a symbol created out of a bitmap image. When I converted the "bitmap" to a "movieclip" object, I selected the center registration point in the dialog box. After the symbol is created an placed on the stage, I can seen the registration point at the center of the movieclip. Nevertheless, if I check the coordinates of the movieclip, it refers to the top left corner instead of the registration point. The most strange thing is that if I try to check the coordinates of the movieclip using Actionscript - something like trace("x: " + mc._x + "y: " + mc._y); - it do refers to the center point of the movieclip. So how can I have the coordinates during design time the same as during runtime? Why do I always have to refer to the top left corner and not to the ACTUAL registration point?
View 9 Replies
Jan 25, 2010
I have this script on an invisible button on a banner ad, but the client doesn't want the linked page to open in a new window, but rather load over the page in same window. How can I change the script to accomplish this,
link_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"));
[code]........
View 3 Replies
Aug 8, 2011
Is there a way to apply a renderer to a grid in a way so that it doesn't modify the values in the data provider? I have a datagrid and on one of its columns I have a customer renderer which overrides the set data function and converts the number value in the dataprovider to a word. My problem is that when I sort the grid by that column it sorts by the new value, whereas I want it to sort by the old value that was originally in the dataprovider. Here is my renderer:
[Code]...
View 2 Replies
Sep 13, 2009
I have a movieclip Planet which consists out of a backround (BG) and a mask (PMask). The mask will be changed during gameplay (I add shapes, then draw this to a bitmap and replace the shapes with the bitmap).But for some reason the mask doesnt change along with the mask movieclip(as if it makes a copie of PMask and uses that as the mask instead, so that every change to PMask isnt applied to the mask of BG)This is basically my Planet.as file (I removed the stuff that isn't related):
Code:
package
{
import flash.display.MovieClip;[code]....
I don't know why I would need the "cacheAsBitmap", but it doesn't seem to mask at all when I don't use it.
View 0 Replies
Feb 3, 2010
I'm having trouble with a script I'm writing and don't understand why. I have
[Code]....
on a a button that I have, but when i test my file and click on the button, it doesn't change frames.
View 4 Replies
Apr 15, 2008
I have a class file that contains a for in loop. basically there are 50 states (movieclips) on the stage and here is what I have:
[Code]...
I don't think I understand enough about arrays or for in loops to understand why this isn't working... it traces the array, but not statesArray[states], and it doesn't change the alpha of anything.
View 1 Replies