ActionScript 3.0 :: Only Target Certain Child Objects?

Jul 31, 2009

I want to set the scaleX and scaleY of certain child objects within a movieclip, but there are tons of other elements inside of it. Here's what I have so far:

for (var i:uint = 0; i < outer_mc.numChildren; i++) {
trace(' | ' +i+'. name:' + timeline_mc.getChildAt(i).name);
}

This returns 60 child objects. The 50 I want to scale down have "_mc" appended to their instance name. I figure I should make a new array or variable and set the scale of those to whatever I want.

View 4 Replies


Similar Posts:


Flash :: Get The MouseEvent.localX And LocalY Of A Target But Not Its Child Objects?

Jul 24, 2009

I'm creating a simple drawing application that adds new Shape objects to a MovieClip "canvas" every time the user clicks and drags. The problem is, I'm noticing that even though the MouseEvent listeners are set to the MovieClip, the child Shape objects are being returned as targets as well. This disrupts the localX and localY as well, causing the drawing cursor to jump around as the coordinates change from being local to the entire MovieClip to local to the Shape the mouse is currently over.Is there any way to retrieve the most parental target from a MouseEvent?

View 1 Replies

Flex :: SWFLoader - Child Apps Couldn't Access Certain Objects That Were Instantiated By Another Child App?

Aug 23, 2010

i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application

<mx:VBox id="content" width="100%" height="100%" ></mx:VBox>
public function doIT():void
{[code]....

when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?

View 1 Replies

ActionScript 3.0 :: XML - How To Target Child

Feb 19, 2010

<?xml version="1.0" encoding="UTF-8"?>
<tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1"  xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
<head>
<styling>

[code].....
 
I think this is a simple question, but can't quite figure it out. How would i read the <div> that is english "en"?
 
something like this - tho this does not work:

trace(_xml.div.(@lang=="en"));

View 3 Replies

ActionScript 3.0 :: Removing Target Child?

Jan 8, 2012

I've run into a problem when trying to move one of my sprites from the stage when it dies.So far what I'm having to do is call the Death method from the main class, which then goes to the Enemy Class in order to play the animation, once the animation has reached the last frame an event is triggered which is situated in the main frame which then removes the now dead enemy from the stage. However it doesn't appear to be able to target the child which I want removed =/Main Class:

Code:
private function hitCheck(e:Event = null):void{
var samuraiPos:Number = SamuraiChar.samuraiPos();

[code].....

View 4 Replies

Flash ::capture Child's Event.target?

Dec 23, 2011

I want to get the value of e.target inside the visual parent of a movieclip( ChildClass). in the following code.

public class ParentClass extends MovieClip
{
public function ParentClass()

[Code]....

View 1 Replies

Actionscript 3 :: Set Up Collision Detect So That It Ignores A Child Of The Target?

Feb 23, 2010

So in my game, every 'enemy' movieclip creates a textfield that represents the name of the enemy. The problem is, I want my collision detect engine to detect a collision with the enemy itself, not the textfield. This is the code that I have currently have on my collision class for detecting a collision with the enemy:

for(var i = 0;i < _enemies.length; i++)
{
if(CollisionEngine.isColliding(_laser, _enemies[i]._enemyNameTextField, _animation))

[code]......

View 2 Replies

ActionScript 3.0 :: Detect If The Target Of A Mouseevent Is A Child Of A Movieclip?

May 29, 2010

I have a parent movieclip with a few other movieclips inside it. When I add a mouseclick eventlistener to the stage and click on one of the children, i want the target of the event to be the parent movieclip. I still need the children to be mouseEnabled.

how do you check if a movieclip is a child of another?

View 9 Replies

Actionscript 3.0 :: Target Child's Attribute Nested In Movie Clip?

Apr 2, 2009

I have a Movie Clip called panel that I have added three children to (points, answer, question). I need to know how to access the alpha property of each child so that on a ClickEvent I can change the alpha so that the appropriate one is showing.[code]

View 8 Replies

ActionScript 3.0 :: Can Subclass Target Other Objects?

Feb 23, 2009

I have my main.swf which has class of Main.as which control everything.Then in main.swf I have 3 movieclips that acts as a button and they share a class of Button.as which controsl all the button functions btn1, btn2,bt3 are all place on stage and in Main.as I control their positions.When you click on a btn, it moves to a new location at the same time the other 2 btns will move as well.I can get the target btn that's been click to move just fine, but I can't get the other 2 btns to move and they all share the same class. I know this probably has to do with a targetting issue... I think. Is there a way I can make the connection in same Button.as class file? Or do I use like some global event dispatch?

View 2 Replies

ActionScript 3.0 :: Target Certain Objects In An Array?

Apr 23, 2010

I have an array with 3 objects and added a click event to them, when clicked the 3 objects move 200 pixels down, but i would like to become that the objects that werent pushed get an alpha of 0.5

View 1 Replies

ActionScript 3.0 :: How To Target Externally Loaded Objects

Jun 15, 2009

i have creating an image gallery of sorts. I have loaded my thumbnails through an xml like so:

Code:

function loadThumbs(){
for (var i = 0; i < totalElements; i++){
var thumb_url = elements[i].@thumbSrc;
trace("totalElements: " + totalElements);

[code]....

now i want to have it so that when u click a thumb, it re-layers them. I am able to get the one u click to the front of the order, but how can i tell the others to layer as i want? I guess the problem is that I cannot use the name of the display object and i can't user image_loader to setChildIndex with.

Code:

function replaceElementAndMoveThumb(event:MouseEvent):void{
setChildIndex(event.currentTarget, numChildren - 1);
trace(event.currentTarget);
}

I am thinking that in AS2 I would use the movieclip instance name, but don't think this works in AS3.

View 2 Replies

ActionScript 3.0 :: How To Target Dynamically Created Objects

Sep 3, 2009

I am learning AS3, and I am trying to understand how to target dynamically created objectsI have the code:

Code:
for (var i:Number = 0; i<5; i++) {
var boton:CreateButton(stage.stageWidth/5,30,0,1,colors[i],test,0xFFFFFF,"English");

[code].....

View 6 Replies

ActionScript 3.0 :: Drag And Drop Multiple Objects, 1 Target?

Feb 9, 2010

I have been trying forever to figure out how to add multiple mc's (images) with different instance names to 1 target only (another image). All of the mc's and the target are placed on the same layer. All I want it to do is snap different images to the same target. I have tried placing the target on a seperate layer but it does not work either.

Here is the code:

ActionScript Code:
cat_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
cat_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
dog_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

[code]....

View 2 Replies

ActionScript 3.0 :: Drag And Drop Objects Onto Target MovieClip

Sep 14, 2009

I have been working with a very simple tutorial over at [URL], where you drag objects onto a target movieClip. My question is this, how do you target a movieClip inside a movie clip? What I have are 4 color squares that I want to drag and drop onto a pattern_mc. I put the target mc's with in the pattern_mc. In the tutorial the target mc's are not in a movie clip. I put my target mc's in a movieClip because I want to use the pattern_mc as a material, and I thought this was the correct way to this.

Code:
//record objects starting position
var startX:Number;
var startY:Number;
//activate objects to be moved
square1mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
square1mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
[Code] .....

View 11 Replies

ActionScript 3.0 :: Getting Multiple Random Objects To Aim For The Same Target From Library

Apr 1, 2011

With some excellent help from ilike2 I was able to import random objects from a library that can then be dragged to their respective targets (on repeat). However, I forgot to mention that I need to drag more than one of these objects onto the same target and I don't know how to change the actionscript to accommodate this. Would anyone be able to help me with this? In the example below I would also like Blue2 to target targetBlue_mc Here is the code:

[Code]...

View 4 Replies

Professional :: Drag Drop Objects To Multiple Target Areas?

Oct 30, 2010

I am trying to make a quiz on metals. I have several elements which i want to fall into multiple target areas (e.g. the target areas are shaded grey in the following swf; metal_mc, nonmetal_mc, metalloid_mc). I can make individuals match to target areas (as there are tutorials for that) but i want each one to be able to slide in to any target area (and someday i want to create a solve button which will then place each element in the correct place). have started all over and have designated only chlorine to move (for the moment) but how do i code it to allow it to fall into any of the grey areas?

var objectoriginalX:Number;var objectoriginalY:Number;chlorine_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);chlorine_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);function

[code].....

View 6 Replies

ActionScript 3.0 :: Drag And Drop - Multiple Objects On Single Target?

May 16, 2011

I want to create an interactive learning module that would use a simple drag and drop test. I've already browsed the net for guides and it led me to monkeyflash.com that gave me a very helpful guide. On the guide, there can only be one object be dragged to a target. But then, I wanted my test to have multiple objects (movie clips) be dropped on a single target (also a movie clip) only and stick to it. I'm thinking that I could place my draggable objects on an array, but I really had difficulty on executing this.
 
On the code below, a drag object can only be placed on one target only (i.e dragIn1 can only be dropped on targetdragIn1 but not on targetdragIn2). Yet, I want all dragAt objects be dragged on all targetAt, dragIn with targetIn, and dragOn with targetOn.

[Code]...

View 2 Replies

ActionScript 1/2 :: Click And Drag Any Of The Objects (black Circles In Case) To Their Target

Nov 30, 2009

I am working on a simple "Drag and Drop" deal and I have encountered an interesting bug that I can't seem to track down. When testing the movie, the FIRST TIME you click and drag any of the objects (black circles in this case) to their target (the big rectangle), all is well. However upon dragging them OUT of the target area, the object appears to "fight back" against being dragged. I am fairly new to Actionscript and can't seem to find the answer for this one elsewhere. I'm going to apologize in advance for the messy script.

[Code]...

View 3 Replies

ActionScript 3.0 :: Listeners In Child Objects?

May 1, 2010

Say my flash project has an object A. In object A is an event and it's corresponding listener B. How do I get listener and event B to function in my flash project? I remember it something to do about "focus", right? Or am I completely off target, ha?

View 4 Replies

ActionScript 3.0 :: ScrollPane - Clip Child Objects?

Feb 12, 2010

Is there a way to dynamicially add graphics objects to a display list that a backbound JPG image sits in, and have ScrollPane automaticially manage scroll and clip for the entire set of objects (the base JPG and 3 dynamicially created graphics objects?? I create a ScrollPane (myScroll) and give it a source .jpg file. Then I create some graphics objects (myRec) and add them as children of myscoll,

[Code]...

View 7 Replies

Professional :: Child BaseClass Objects Cannot Share Same Name

Jul 3, 2010

On stage I have 2 objects on stage that share the base-class of "ABaseClass". Each has a child object that shares the base-class of "AnotherBaseClass". They child objects do not share the same parent, and have unique Linkage identifiers of "Object2Design" and "Object1Design", so they should be able to share the same name on the display-list, right? But if these child objects share the same name I get the following error. How to allow child objects to share base-classes and names?

TypeError: Error #1034: Type Coercion failed: cannot convert Object2Design@256cfe81 to Object1Design.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at AnotherBaseClass()
at Object2()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
Example: [URL]

View 1 Replies

ActionScript 3.0 :: Remove Multiple Child Objects?

Mar 31, 2011

On my flash application I am using the Google map API this creates a child object I have removed this on every other page with [code]...

View 8 Replies

ActionScript 3.0 :: Positions Of Child Objects Oddity?

Sep 12, 2011

in short, i have object A, a container. Within this is object B (a child object) which has some x and Y offset that I input.I need to know the offset of object B, because i want to place other objects at the same onscreen position as B, but on the same level of the heirarchy as object A My problem though, is that B's offset from A isn't changing when i would expect it to - when the parent object is scaled. I set B's x offset to 200 pixels, and no matter how much i scale up or down the parent object, B remains in the same visual position relative to it. And B's x property is still 200, regardless of parent scale.This information is not meaningful to me, because i know that B's actual offset position from A is more or less than 200 onscreen pixels. I need to be able to figure out exactly what it actually is.

View 2 Replies

ActionScript 3.0 :: Removing Listeners In Child Objects?

May 1, 2010

I'm moving two objects accross the stage at different rates using the same function:

Code:
function moveClip(clip,speed){
clip.addEventListener(Event.ENTER_FRAME,moveIt);
function moveIt(event:Event) {

[Code]....

In AS2 I'd just use dot notation as above and it would work from anywhere or perhaps _root.red....

I've tried root. stage. childbyname Not sure where to from here.

View 2 Replies

ActionScript 3.0 :: Extending SimpleButton So Can Access Its Child Objects?

Jul 3, 2009

i have a simple navigation system with three buttons, each button have a text field in it. On mouse over they change color to blue. I can achieve all these without a single line of code. I simply make a button of my text field in flash, and change the color of the text in the timeline.
 
My problem occurs when i want to make the color to stay blue when i click on the button. Apparently you can't access the child within a button, in my case a dynamic text field.  I've googled this problem and they all say that you should use a MC instead of a button. Thats exactly what i have done so far. But i'm getting tired of writing a bunch of eventlisteners and put an extra layer with an invisible button in my button mc so i can get the hand cursor (because the .buttonMode  = true and useHandCursor doesn't work when there is text field inside the mc). Any way, shouldn't there be a more elegant way to solve this problem?
 
I've been trying to build a new base class for my button that extends SimpleButton, and from there access the embedded  child object, but the problem remains.
 
In this example i'm trying to simply change the text of the text field inside of my new MyButton instance. But i get the same old Error #1009: Cannot access a property or method of a null object reference.
 
package
{
import...
public class Mybutton extends SimpleButton

[Code].....

View 6 Replies

Flex :: Null Cast Between Parent And Child Objects?

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

ActionScript 3.0 :: Display Objects Parent Child Relationship?

Sep 22, 2009

Confused over actionscript children. Reading a book on this shows the following code:

var firstContainer:Sprite = new Sprite();
var secondContainer:Sprite = new Sprite();
secondContainer.addChild(firstContainer);

[code]......

View 6 Replies

ActionScript 3.0 :: Add Event Listener On Parent For Event.target = Child?

Jul 30, 2009

I have these buttons in a movie clip and I would like to have only one event listener for the parent, using event.target to point to the children. I have also tried event.currentTarget, and it didn't work.here is the code that works:

test01.abtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
test01.bbtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
test01.cbtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);[code]....

It is only targeting the movie clip, not the buttons inside the movie clip.

View 4 Replies

Actionscript 3 :: Testing For Undefined And Null Child Objects In Flex?

May 20, 2010

I use this pattern to test for undefined and null values in ActionScript/Flex :

if(obj) {
execute()
}

Unfortunately, a ReferenceError is always thrown when I use the pattern to test for child objects :

if(obj.child) {
execute()
}

ReferenceError: Error #1069: Property child not found on obj and there is no default value.Why does testing for child objects with if statements throw a ReferenceError?

View 3 Replies







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