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


Similar Posts:


ActionScript 3.0 :: Drag And Drop Multiple Objects To Multiple Target?

Sep 10, 2009

im creating a small drag and drop game in AS3-
 
I have 4 objects and 4 targets,
 
I want to be able to drag any of the 4 objects onto any of the targets, right now all I can manage is to allow each object drop onto one specific target only.
 
I thought by calling all my target names by the same instance name eg target_mc that would work but only one target will ever work.

View 8 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

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

Javascript :: Javascript - Target Multiple Objects With A Single Operation Using ECMAScript's `with` Statement?

May 2, 2011

The following doesn't work (although it gives no explicit error), but why not?nd... Is there really no way around it, strictly using the with statement? Forget using for / foreach.

with (object1, object2) {
attribute = value;
method();
}

Why the code above gives no syntax error, doesn't work but is accepted by with?If it's possible, how could we change multiple objects with same attribute using with?

var object1 = { attribute: 3 };
var object2 = { attribute: 2, method: function() { alert('blah'); } };
var object3 = { method: function() {alert('bleh'); } };

[code]....

View 2 Replies

ActionScript 2.0 :: Math.random - Slide To A New Random X Position When Mc Is Less Than 5 Pixels Away From Its Target

Mar 3, 2004

What I want is for my mc to slide to a new random x position when it is less than 5 pixels away from its target, it keeps doing this. the problem is for some bloody &*�$(()** reason my random numbers only keep going up!! why is this?? i want to produce random numbers between 1 and 770 - this is my code..

[Code]...

View 5 Replies

ActionScript 3.0 :: Random Objects Using Math.random?

May 4, 2011

basically I want my engine to display one out of three objects at random. I thought I had figured it out but apparently not. A familiar error message appears, "A term is undefined and has no properties". I'm sure it refers to the object I'm trying to spawn, however it rejects every object I refer to. Is my approach reasonable or should I scarp what I've got?

Code:
var spawnObject:Array = new Array("Object1", "Object2", "Object3");
var randomNumber:Number = Math.round(Math.random() * (spawnObject.length - 1));
if(spawnObject[randomNumber] == "Object1")

[Code].....

View 5 Replies

ActionScript 3.0 :: Target Clip In Library?

Aug 8, 2009

I have a clip that is manually dragged from the library and I simply want to target this movie clip in the stage but through library using actionscript.

View 1 Replies

Actionscript 3.0 :: Setting A Target Path For A Library | Flash CS4

Jul 9, 2009

I am trying to create a class library in the documents folder on my mac to save reusable .as classes. I tried following the tutorial on gotoandlearn about this, but it doesn't seem to be working out. I set the path in the prefs in flash using the browse button, and then set up the import line in my .fla. When I test, I get errors that say that flash can't find the dir that I am trying to use. Here are some details...

This is the dir structure that I am trying to use to store my classes.

This is how I am trying to link up to the classes using import in flash.

Here is the preference settings that I am using to get flash to look in the dir structure above to find classes to import.

View 3 Replies

ActionScript 2.0 :: Loading A Random Swf. Into A Target?

Aug 3, 2003

I am trying to load 1 of 4 swf. files randomly into a holder on a home page.

the code I'm using doesn't work.

[Code]....

when I test the movie I get an error message that it can't find the movie. As an example, the code is adding a 1 to the name of the swf. image11.swf

View 3 Replies

ActionScript 2.0 :: Load Random Movies Into Target Mc?

Nov 20, 2007

I am in the process of creating a VS Card game in Flash. It is basically a game where you can choose either one card or another, each randomly pulled from one of the eight different sets. The first card (or swf) can be pulled from any of the 8 sets (out of a total of 12 cards in each set))..and will load into a targetMC, and the second must be pulled randomly from any of the 8 sets except from the folder where the first card was chosen and load onto the second targetMC.

View 1 Replies

ActionScript 2.0 :: Random Selection Of 4 Tell Target Movies?

Dec 2, 2004

How do I randomly select 1 of 4 tell target movies? (Flash MX Actionscript)

View 1 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 :: 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

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 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

AS3 :: Flash - Listening For Multiple Events On Multiple Objects?

Sep 20, 2010

I currently have an over, out and click event for 8 different objects. The over and out events are identical for each (tween expands object and then shrinks it back for the out state).I have previously asked for an easy way to declare those events, and now I was looking for an easier way to handle them.

Here's my code:

//-----------GARAGE
function growGarage(e:MouseEvent):void{
scaleTweenX = new Tween(map_garage, "scaleX", Elastic.easeOut, 0.648, 1, 0.5, true);

[code]....

I've tried using a single function and then using "this" as the object of the tween but that expanded the entire stage.

View 1 Replies

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

ActionScript 2.0 :: Random Mc From Library Once?

Jan 14, 2010

There are some threads about this but they are all pretty messy What I am looking for seems pretty straight forward. User push a button, a random mc is attached from the library. User keeps pushing the button until all mc's are shown, i.e. all mc's are shown only once.What I got is 5 mc's in the library with linkage 1 to 5. Button with instance "button" and a empty target mc with instance "targetMC". Code I got is

Code:
stop();
card = new Array("1", "2", "3", "4", "5");

[code]....

View 5 Replies

ActionScript 3.0 :: How To Add Random Mc From Library

Aug 4, 2009

How to add random movie clip to stage from many different movie clips in library?If I wanted to add one movie clip to stage I would do liko so:

Code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
function onMove(e:MouseEvent):void {

[code].....

View 2 Replies

IDE :: Add Multiple Target Types?

Nov 24, 2009

I've been working on a cute game and I've hit a bit of a wall

It's a shooting gallery game and I want to add multiple target types (so far this has been easy) but I want to game to randomly bring them up as you play. There are four possible target spots and seven possible targets:

baddie1
baddie2
baddie3
baddie4
baddie5
baddie6
goodie1

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 :: Multiple Arrays Containing Multiple Objects?

Oct 11, 2009

What's the best way to say:

if(this.object in same array as that.object)

with multiple arrays containing multiple objects?

View 2 Replies

ActionScript 2.0 :: Load Random From Library 10 Mc's?

Feb 20, 2009

Im trying to load random from the library 10 mc's. Which is not a problem.

But once the loaded movie finishes playing would like to unload it and to load another random another movie and so on.

View 4 Replies

ActionScript 3.0 :: Target Of Multiple Movieclips?

Feb 13, 2012

i basically have some images of logs (for a bridge) setup inside a movieclip called log_mc, inside log_mc each log has its own movieclip log1_mc, log2_mc and so on

[Code]...

View 29 Replies

ActionScript 2.0 :: How To Target Multiple Buttons

Aug 6, 2006

[code]I can contorl the current selected mc.like myButton1.But How I can control the other button action at the sametime.like myButton1._alpha =50, myButton2,myButton3,myButton4...._alpha = 30.

View 5 Replies

ActionScript 1/2 :: Load Random Mc From Library Array

Jul 2, 2010

I have 15 empty placeholder on my stage, named "empty01" - "empty15". I have 15 mcs in my library, with linkage identifiers "01" - "15".

[CODE]...
 
I would prefer for 'empty01' to load a random mc. Can anyone advise how I could achieve this? I have tried to create an array containing the 15 library mcs (not sure if this is correct):

[Code]...

View 4 Replies







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