So I have this code to create and load an external swf. I am trying to write a simple function to target the mc within the loaded swf. Once clicked I want it to load a new swf inside the same mc (container_mc). I'm having trouble even targeting that button though. Any thoughts?
If objects are created dynamically in AS3, using code like this:
for (var num:Number = 0; num<10; num++){ var txtFld:TextField = new TextField(); txtFld.text = 'This is the original text'; this.addChild(txtFld); }
then later, i want to changet the text of one of the TextFields, how can I do that? The only instance listed in the variables is a single instance of "txtFld" and it is the last one that is created. How can I access the others?
I have a scroll pane with textboxes and buttons that are dynamically created in a function. The textboxes are a user list that can get very long.
I am having problems where once I get out of this frame I want everything to be removed. I have tried removing the scroll pane but all the dynamically created objects remain. Is there some command when you enter a new frame to clear all objects or something along that line?
iam in a situation to convert the dynamically created objects( just movieclips which contains boxes,texts etc) in flash using AS3 to .DWG format. i tried converting the flash objects in to SVG format , then tried to open it in Auto Cad , but the texts are not editable in auto Cad;
So I have an object, generated on each click of the mouse. It's set up as a series of points with properties, with values for position randomly calculated, and set around where the user clicks the mouse. Lines are drawn from where the mouse is clicked out to each of these points, so it kind of looks like a star, but only lines, rather than a solid shape (like those old 50's atom clocks?). So once clicked there's an enter frame event listener on the object so that each of the points 'wobble' (using a randomly generated number) up and down around the original point.
For some reason, I can either set it so that on each new click of the mouse and newly generated object, the last one stops "wobbling" and only the new one does, or each new object moves to where the new object is, and maybe is still wobbling(?), but is underneath the new object. This way has the event.target as a new object in the wobble function, so I think it may be just a case of where the centre point is - i.e. saving the mouse x and y for each object individually, or perhaps I have too much of the setup function code repeated in my "wobble"function?
i have 2 layers, called typer layer and plain layer... on the plain layer i have drawn out a shape... like a circle for instance.... if plain layer is on top of typer layer everything works fine. if plain layer is below typer layer the typer does not type.... it doesnt even show up. at present the dynamically created text field into which the typing text will be put into has a depth equivalent to that of a guide inside the component (just a plain mc used for determining sizes etc nothing special) +1 i added 1 to its current depth because if i dont i only seem to get EITHER the circle OR the typer.... whereas if i add 1, i get EITHER the typer AND the circle OR just the circle..but this doesnt make sense does it? i mean if the typer layer is on top then it has a higher depth (ie. closer to zero as depths are currently in the negatives still ) so if i add 1 it shouldnt conflict with anything and i should get it typing and displaying the circle surely?and if it is below then the circle has a higher depth so in this respect if the typer wouldnt work when it is on the bottom i could understand this as the depths would be conflicting and as such the dynamically created text field couldnt be created in the first place because the depth level is already occupied....
im building a full as anything text-typing-component... easily modified and adapted etc...one problem however... i came across a depth issue in testing.... its a little peculiar so you will have to bear with me... i have 2 layers, called typer layer and plain layer... on the plain layer i have drawn out a shape... like a circle for instance.... if plain layer is on top of typer layer everything works fine. if plain layer is below typer layer the typer does not type.... it doesnt even show up....
I'm dynamically creating movieclips with dynamically created movieclips inside them and am having trouble with targeting them.Below is a simplified example of what I'm trying to achieve, in the real file there are a lot more movieclips and I'm creating and naming them with a for loop.
This one is just one Sprite created inside another sprite. I can target the top level sprite named "testname". However when i try target the nested MC it throws an error.The bottom couple of traces are just test MCs I've made to make sure i got the syntax right, on targeting nested movieclips.
PHP Code:
var holder:Sprite = new test1();holder.name = "testname";this.addChild(holder);var holder2:Sprite = new test2();holder2.name = "testname2";holder.addChild(holder2);trace(getChildByName("testname").x); //this one traces finetrace(getChildByName("testname").getChildByName("testname2").x);//this throws up an errortrace(testclip1.x);trace(testclip1.testclip2.x);
Essentially, I've got a MC container that's created dynamically based off an XML file (basically for every <title></title> I've got, it makes a new "card"). Now within the context of each <title></title> grouping I've got <imgs></imgs> in which I specify the path to images that are related.All of that works perfectly, save for the external jpg files actually appearing on the stage. The MC I add them to does, but the external image doesn't.My problem is- I can't add the external images until they're completely loaded (or so it appears). The thumbnail BG I use is blank. So I know for a fact that the thumbnail BG isn't occluding the loaded thumbnails.
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?
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.
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
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.
If I press the button for the photogallery it creats new Objects, and dont erase it after i go back to main. So long its load all the objects in the memory and its exists all the time...
But I want that, delete all the objects from the memory after i go back to the main!
here is the source code:
Code: /* Created by Min Thu http://www.flashmo.com AS3 References and Credits
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.
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] .....
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:
i created a "for" function who īll display an X number of buttons with addChild, and give a name for each using button.name = "name" + variable but later if I want to listen for the buttons using their name donīt work, already know that there is getChildByName so i tried but give me the same error who tells that there no object with that name.My question is, how i can listen for the objects created if i already have a name for each one of them? here is the code im doing.
for(var i:int = 1; i <6;i++){var miBoton:boton = new boton();var miTexto:TextField = new TextField();miBoton.x = i * miBoton.width + (i* 10);miBoton.y = 20;addChild(miBoton);miBoton.name = "boton" + i;miTexto.text = "hi";miBoton.addChild(miTexto);trace(miBoton.name);trace(miBoton.parent);}
I have an issue in flex which is causing a bit of a headache!
I am adding objects to an ArrayCollection but in doing so, another ArrayCollection is also picking up these changes even though there is no binding occurring.
I can see from the debug that the two ACs have the same address but for the life of me can't figure out why.
I have two Array Collections:
model.index.rows //The main array collection model.index.holdRows //The array collection that imitates the above
This phantom data binding occurs only for the first iteration in the loop and for all others it will just write it the once.
The reason this is proving troublesome is that it creates duplicate entries in my datagrid.
public override function handleMessage(message:IMessage):void { super.handleMessage(message);
So I'm trying to create an object in my document class then reference it from a custom class file.I'm creating a photoContainer MC in the createPhotoContainer method and directly after it's creation it gets passed to the GalleryView class by calling it's constructor function.
ActionScript Code: public class GalleryDocument extends MovieClip {
I need to be able to make a large amount of concentric circles, using only the action script. I need to be able to alter each of these concentric circles independently from each other. Currently My code is as follows:
ActionScript Code: var circ1:MovieClip = new MovieClip(); addChild(circ1);
I've worked out a way to get the proper instance name in stored in a variable (called listName), and I've got a SOUND_COMPLETE listener applied to my sound channel. What I need to happen is, when the function called by the SOUND_COMPLETE event fires, the object on the stage with the instance name that matches the string currently stored is affected.[code]...
I attached some movieclips dynamically from the library, and the MC contains a button symbol called "myBtn", I would like to let it load another swf on _level3...below is part of my Actionscript.
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
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.
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?