ActionScript 3.0 :: Trying To Swap Child Index On Click

Feb 20, 2009

I have 3 objects (mask_cat, mask_dog, mask_sea_monster)on the stage and I want the user to be able to move them independently with the ol' click and drag.[code]So far only the, sea_ monster moves. The odd thing is the sea_monster moves when I click on the dog or the cat also, but not if I click anywhere else.

View 0 Replies


Similar Posts:


ActionScript 3.0 :: Flex Trying To Swap The Index Of Children On Click?

Feb 19, 2009

I have a feeling I might be going about this all wrong. I have 3 objects (mask_cat, mask_dog, mask_sea_monster)on the stage and I want the user to be able to move them independently with the ol' click and drag. This is what I have:

[Code]...

View 4 Replies

ActionScript 3.0 :: Can't Swap Child For New Class Instance IF Child Is Exported For Action Script?

Aug 18, 2010

I have a movieClip with one frame on the timeline containing one child whose instance name is "myContent"I am using this function to swap "myContent" with any number of possible class instances.

Code:
function setContentAsClass(c:Class)
{

[code].....

View 2 Replies

ActionScript 3.0 :: Swap Children Of Stage From Inside A Child?

Apr 26, 2008

I have 9 movie clips which are all of the same object, they get larger or smaller as the mouse gets closer to their respective centers. The functionalilty for this is in an AS3 class file that extends flash.display.MovieClip.How do I go about swapping depths so that the largest one is in the foreground, I am new to AS3 and dont seem to be able to find a way of getting the depth of the movieclip I am currently inside (this) and if I try to access the stage to call swapChildren I get the following runtime error:

View 6 Replies

ActionScript 3.0 :: Swap Out Symbols With Click?

Apr 24, 2010

How to take one symbol and when I click, convert it to another until I release. Imagine a hand(which is what I am using) and when you click, it pinches 2 fingers together until you release. I have both symbols created but I am stuck as to how to get flash to perform this. The only help I could find was how to make movies play with a click.

View 3 Replies

ActionScript 1/2 :: Swap Image - On Click Go To And Play

Nov 21, 2009

I'm a beginner in flash actionscript. I want to basically swap images using actionscript. So if you click on a thumbnail, the main big image will change corresponding to the thumbnail being clicked. I don't want to use a simple on click go to and play actionscript... I'll try to paint a picture of what I'm trying to achieve.

There is a background image, middle ground and foreground image... people will have a selection of thumbnails to chose from to change these images (so they are creating their own big picture) Once the user clicks on a thumbnail for the background, the main image will change corresponding to the thumbnail.. and the same for middleground image and foreground image. I can acheive this in director using lingo but I am required to use flash and actionscript.

View 12 Replies

Arrays :: How To Swap Flash Var On Mouse Click

Feb 4, 2011

I have Flash var array that I want to swap for another array on mouse click. It currently loads the initial array into the empty MC perfectly. Now I need it to swap to var productTxt2 when the user presses buttonMC. My code is below.

AS2 code:
var productTxt1 = new Array(
"Product Name 1", "Price 1", "Headline 1", "Copy 1");
var productTxt2 = new Array(
"Product Name 2", "Price 2", "Headline 2", "Copy 2");
_root.createEmptyMovieClip("productInfoMC", 0);
[Code] .....

View 1 Replies

Flex :: Image Swap On Mouse-over And State Change On-click?

Dec 4, 2011

I am learning Flex and have an image I would like to changed on mouseover, and switch to another state on click.I do not want to use any of the buttons available in Flex.Does anyone know th code to achiev what I want?

View 1 Replies

ActionScript 2.0 :: Drag-swap Movie - Dragged On The X Coordinate On Click

May 14, 2004

I have a movie that I want to be dragged on the x coordinate on click, and if you drag it to the left it should play a different movie then when you drag it to the right. here is what I tried so far and of course it does not work.

[Code]....

View 1 Replies

ActionScript 3.0 :: Having One Image Below Another Using Child Index

Jan 26, 2010

I'm not too familiar with how I can use the getChildIndex() along with an if statement in a mouse_move event to make sure one image is always above the other or one is always on the bottom

View 4 Replies

ActionScript 3.0 :: Add A Child Of Index 2 Or Higher?

Mar 3, 2010

I'm working on a project conversion from AS2 to AS3.
 
In AS2, I used a mainMenu file and loaded a Navigation file at _level 999 (very top). Then I loaded and unloaded different modules on _level 5.I also loaded and unloaded an external Glossary file on _level 95.Now in AS3 I am using AddChildAt(1) for the Naviation file and AddChildAt(.1) and removeChildAt(.1) for the module files. The Glossary file only seems to work at Child Index 1, so I'm guessing it pushes the Navigation file to a higher index. Is there a reference that explains the Index properties of the Child and why sometimes I get an error when I try to add a Child of Index 2 or higher?

View 3 Replies

ActionScript 3.0 :: Won't Let Reset Child Index?

Jul 15, 2010

I've got multiple images being loaded from an xml document and when they're created they add it to the stage and call a setIndex function to set it to 0. But when I try to the same object later on when they're called I get this compiler error:
 
I marked in bold the lines that relate. Out of the last two lines I marked bold I get this compiler error when I use the first one: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:Sprite.
 
and this output error when from the last bold line: TypeError: Error #2007: Parameter child must be non-null.

[Code]...

View 2 Replies

ActionScript 3.0 :: Access Child At Top Index?

Dec 13, 2011

I am adding movieclips (myBall) to the stage by the click of a button. There is a base class applied to myBall which allows it (and its children) to be dragged and dropped. Within the base class on mouse down, along with startDrag, the movieclip is being brought to the top index. I would like to be able to refer to this movieclip in my document class. The point of doing this would be to apply a function to the last clicked movieclip (finding what movieclip was last clicked would happen by applying the function to the movieclip (myBall) with the highest index).[code]...

View 7 Replies

ActionScript 3.0 :: Setting Child Index In A Class?

Sep 26, 2009

Im trying to build a class that moves around some movieclips on the stage, but it would never be that easy would it!

Code:
package {
import flash.display.MovieClip;
public class Rotation extends MovieClip {

[Code]...

So I waddled it down to the "stage.addChildAt(mcContainer[i], i);" bit and I've tried everything that I could think of, but nothing seems to work.

With this version of the code, I would get "The supplied index is out of bounds." error, I can change it to addChildAt etc, but that just gives me a different error.

I had this working when it was in a flash file, its converting it into a usable class thats bugging me. All the MovieClips in the array are being exported for Actionscript.

View 2 Replies

ActionScript 3.0 :: Setting Child Index From Within Array?

Sep 14, 2010

Here's what I'm trying to accomplish: I have as3 script that successfully displays an array of MovieClips, the MCs have variable xy positions, and in some cases they overlap each other. I have a function within the array that I can't quite figure out. Here's what I'd like the function to do: When the cursor rolls over a particular MC displayed by the array,I'd like that MC to be brought to the front of the others. This is my script:
 
var myArray:Array = new Array(); for(var i:int=0; i<8; i++) { myArray[i]= new myImage();addChild(myArray[i]);myArray[i].x = 180*i;myArray[i].y = 330;myArray[i].addEventListener(MouseEvent.ROLL_OVER , overlap);
function overlap (event:MouseEvent):void
{trace('function triggered on image ' + i);

[Code]...

View 3 Replies

ActionScript 3.0 :: Trace Child Index Number?

Mar 5, 2012

I want to know the index number of the object when I clicked it..

trace(mc.getChildAt(0)) = display the object at the index 0 lets say the output is [object] button

now I want to reverse it..

when i click the object button

button.addEventListener(MouseEvent.CLICK, onClick)
function onClick(e:MouseEvent)
{

[Code]....

View 1 Replies

ActionScript 3.0 :: Change Child Index And Alpha?

May 16, 2010

I have 10 movie clips on the stage all of them are on the same layer and the alpha property at 0.5.

I want a single movie clip to randomly move to the top of the other at timed intervals. This movie clip alpha property will change to 1 while the other movie clip will remain at 0.5

View 5 Replies

ActionScript 3.0 :: How To Trace Child Index Number

Mar 5, 2012

I want to know the index number of the object when I clicked it..
trace(mc.getChildAt(0)) = display the object at the index 0 lets say the output is [object] button
Now I want to reverse it. When I click the object button
button.addEventListener(MouseEvent.CLICK, onClick)
function onClick(e:MouseEvent){
trace(e.currentTarget.????????)
//I want to trace what index number is that button, the output should be "0"
}

View 1 Replies

ActionScript 3.0 :: Child - Parent - Index Level Setting?

Jul 2, 2009

I encountered and did not make heads or tails out of this whole new concept of child, parent and setting a index level. What is an index level and this 'child and parent' thing?

View 3 Replies

Arrays :: Changing Child Index Of MovieClips Based On Their Y Position?

Mar 1, 2012

I'm writing a game with Flash CS5/AS 3.0 that tries to simulate depth of field by drawing all the relevant Movie Clips based on their Y position in ascending order, i.e. things lower on the stage overlap things higher on the stage. A MovieClip with a Y position of 10 would therefore need to have a lower index compared to a MovieClip with a Y position of 20, so the second one gets drawn on top of the first.

I wrote a quick and dirty function just to test this. During the trace, I've noticed that the truck's index hits 0 when I go near the top of the stage, but if I go too far up it will completely disappear from the stage. Trace then starts generating this error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at EICT::Game/ReorganizeDisplayIndexes()

[Code].....

View 2 Replies

ActionScript 3.0 :: Tween Child Display Object Index Getting Screwed Up?

May 1, 2009

I have a set of buttons which trigger menu panels to tween up from below the screen. I want these menu panels to be displayed behind the buttons (which are displayed on the button edge of the screen). So I add the menus to the parent container, then I add the buttons, so that the menus would be behind the buttons and getChildIndex(buttons) = 1 and getChildIndex(menus) = 0.

The menus are correctly displayed behind the buttons when I comment out the tween code. But when I implement the tweens and start the tween of the menus, they do their motion tween but are displayed in front of the buttons instead of behind; somehow their display object index order got screwed up.from the Menu class:

Code:
this.tweenIn = new Tween(this, "y", Regular.easeOut, stageHeight, stageHeight - this.height, 2, true);
this.tweenOut = new Tween(this, "y", Regular.easeOut, stageHeight - this.height, stageHeight, 2, true);[code].....

View 9 Replies

ActionScript 2.0 :: Grab The First Index And Add One Each Click Right?

Mar 27, 2004

I've just started playing with arrays in MX, part of my project needs to have information from an array loaded into a dynamic text box one by one, ie

Click the button, text[0] displays, click again, text[1] displays, etc.

So all I have to do is grab the first index and add one each click right?

View 3 Replies

ActionScript 3 :: Getting Index (Click Event) Of Loaded MovieClip Image

Jan 11, 2011

I am loading a set of thumbnail images from an array [hard coded] into a movieclip symbol on the stage. I have two arrays with the thumbnail and the full size image having the same index number. In many examples, "event.currentTarget.contentLoaderInfo.url" returns the full path to the image selected. i just want the index number. Adobe does not make is easy to figure out what other properties are available to me from the contentLoaderInfo. Is 'SelectedIndex' or something like that available? Where does an inspiring AS programmer find the contentLoaderInfo properties and or methods available? Is url the only thing that us usable here?

var thumbnails:Array = ["tn_2010OpenHouse_00.jpg","tn_2010OpenHouse_01.jpg"];
var images:Array = ["2010OpenHouse_00.jpg","2010OpenHouse_01.jpg"];
var thumbX:Number = 10;
var thumbY:Number = 623;
var loader:Loader = new Loader();
loader.load(new URLRequest("images/" + images[0]));
addChild(loader);
loadThumbs();
[Code] .....

Output:
Index= -1
Index= -1
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

View 2 Replies

ActionScript 3.0 :: Go Back To The Index Page And Click A Different Button, The UILoader Will Not Show Swf?

Oct 18, 2010

I have an index page with several buttons on. When the buttons are clicked, it takes the user to a different point in the timeline and loads the appropriate swf in the UILOader I have on stage.Everything was working fine, but it has suddenly decided to stop working. Now if you click a button on the index page, it loads the relevant swf just fine, but when you go back to the index page and click a different button, the UILoader will not show the corresponding swf and just appear blank, although I know its there as I can hear the sound of the swf playing! I'm not sure if its simply something blocking the swf, but I don't even know what it is! I'm using addChild to add little panels to the screen when a button is pressed, but they are hardly big enough to cover the whole of the UILoader!

View 1 Replies

ActionScript 3.0 :: SwapChildren - Swap The Buttons When CLICK Or ROLL_OVER Buttons

Mar 8, 2010

I have 4 buttons , one container and one background movieClip as the attached file shows. Well.. at the Gallery movieclip displayList I add the other three BLACK buttons like this:

[Code]...

Everything I need consist on swap the buttons when i CLICK or ROLL_OVER those buttons, how do I do on thats circunstance? With a container and a background at the same displaylist.

View 2 Replies

ActionScript 2.0 :: Swap Depths - If I Click On The Space Between The Nested Clips In The Top Clip It Actually Is Hitting The Buttons(movieclips) On The Other Clip Under It?

Apr 11, 2007

I have two main clips with clickable clicks within each. I am using swapDepths on the two main clips in a tab navagation fashion. The problem is that if I click on the space between the nested clips in the top clip it actually is hitting the buttons(movieclips) on the other clip under it. Any suggestions?

View 1 Replies

Actionscript 3 :: Update Xml Document's Child Regardless Of It's "vertical Index" / Depth In It?

Dec 23, 2009

I'm in a situation where I have a xml document which is going to be updated in the following way: The deepest child within the document which surrounds a certain x,y position (depending on it's x, y, width and height attributes) is going to get a new child element. If multiple childs exist with the same depth, the bottom one is updated.

My first step was to find this deepest child, this already caused problems, but I managed to solve this with the following recursion[code]...

View 2 Replies

Flash :: Get The Specific Array Index Based On Value Inside The Index's Object?

Jun 22, 2011

So, for sending to individual streams we have to reference the connected netStream we want to send to in some way like this:

sendStream.peerStreams[0].send("MyFunction",param1,param2);

and I have to determine which peer I'm sending to by their ID such as "peerID1234"

I know that you can check the peerID of the stream by doing:

sendStream.peerStreams[0]["farID"]

how can I make my send stream function know to use the array index where the peerID is?

so basically it could be like:

sendStream.peerStreams[where peerStreams[]["farID"] == peerID].send("MyFunction",param1,param2);

View 1 Replies

ActionScript 3.0 :: Click Event On Child MovieClip?

Jul 28, 2010

I have created a movieclip called allbuttons.swf, inside this movie i've created some movieclips by hand (button1,button2 etc..)Through the loader class (in combination with) URLRequest i managed to load the swf inside menuholder.swf but i keep getting stuck on how to manage events on buttons/movieclips inside allbuttons.swfI want to make the buttons/movieclips in side the loaded movie (child) clickable.. but i mange to fail everytime.. i litterly tried everything..- place the eventlistener in the child movie- place the eventlistener in the parent movie- adding an eventlistener to the loaded swf and tyring to catch e.currentTarget..nothing works, i don't see what i am doing wrong, probably learned some basic stuff wrong.

View 0 Replies

ActionScript 3.0 :: MouseEvent.CLICK Blocked By Child Bitmap?

Jul 4, 2010

If anyone has come across this problem or is educated enough so that you may come up with a working solution then please post here. Okay so at the moment I have 2 swfs. One swf is the main swf, which contains a class called Avatar. This class extends Sprite and has 1 child, which is a bitmap image.
 
What I do is load the child swf into the main swf, create an object of the Avatar class and pass the Avatar object down to the child swf. The child swf takes this object and adds it to a Sprite object as one of it's children. Then I add an event listener for MouseEvent.CLICK to the Sprite object (the one containing the Avatar sprite) that is in the child swf.
 
Now when I go to click the Avatar bitmap inside the Sprite inside the child swf. The mouse click event does not fire.

View 2 Replies







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