ActionScript 3.0 :: Trying To Duplicate An Instance On Drag
Sep 28, 2010
On line 72 of DragGame.as, I have the following function which should place a copy of the selected movieclip in the container_mc movieclip:[code]I don't get any errors on publish but when I click a movieclip I get the following message:[code]I've tried rewriting this function over and over to no avail.
My problem is that when I click the letter movieclip it does create the duplicate as it should and it starts to drag the duplicate mc. However, when I release the clip it doesn't stop dragging? I realized that if I put onMouseUP event instead of onRelease it actually does stop dragging when I release the mouse. I would, however not like to use the onMouseUP event if possible.
I'm currently working on this project using AC3 which is why I'm posting here.duplicate the drag and dropped movie clip at the point where it is being dropped. I've tried following the other threads related to this .
-The items being dragged and dropped will have a copy of it at the point where it is dropped.
-At the spot where it is being picked up, it must still remain in that same spot.
-The copies that are dropped is able to move, but not able to duplicate.
eq_10mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp); eq_10mc.addEventListener(MouseEvent.MOUSE_DOWN, dropIt); function pickUp(event:MouseEvent):void{[code]........
I'm doing this drag and drop animation where object 1 is dragged to object 2. When object 1 is dropped onto object 2, I need more than one image of object 1 to appear. I've used this simple code for drag and drop:
I am working on a presentation that a user can drag and drop objects from a "component library" onto the map. I want these objects to be duplicated draggable MCs. I have found a very similiar, but more advanced example here: url...In addition to drag and drop and duplicate MCs, this example also scales and rotates the MC, but all I want to know is how they 1)duplicate the MC after one is dragged onto the main screen 2) Clear screen.
I have a movie clip, that has various codes attached to it to snap to areas of the screen. If I apply the duplicate movie clip command to this, the second instance will have a new name right? so how can I change the code that addressed the original movie clip to relate to the new instance with the new name?
I haven't seen much to explanation of this in any Flash documentation,but maybe someone knows more about this. Initially I was trying tofix a buggy application. The app is fixed now, but I'm still curious.I have an app that defines some object instances (buttons and movie clips)in various frames and on various levels of a timeline. For any object thatneeds to be manipulated by AS, I give it an instance name. However, there's no safeguard against giving several instances the samename. So, I experimented with giving two buttons, on differentlayers and different frames, the same instance name ("playbtn"). Then I defined an event handler:
playbtn.onRelease = function () { gotoAndPlay(1); }
I am trying to dynamically create a number of click buttons based on the content of an XML file.
So I have a MC (window_mc) which contains a single button (more_details_btn). I add an event listener to send the user to a web page on click.
However. On some items I need more than 1 more_details_btn's. What is the best way to duplicate this MC and assign a new click event and different text.
Below is the code I am currently using and it is causing me all sorts of problems
Code:
for each(var detail:XML in productXML.details) { var btn = new more_btn_cls(); btn.label_txt.text = detail.@name;
[code]...
Firstly, it wont assign btn.label.text - it says it "Cannot access a property or method of a null object reference" btn in this code traces as an object not a movieclip is that why?
The other problem is that window_mc.addChild(btn); does nothing, yet if I take away window_mc it does add the clips to the Stage. (I need them inside window_mc though)
Ive made a FLA that has 360 frames.. on each frame there are 5 instances of a movie clip, each of which ive had to painstakingly position and adjust the perspective of with the 3d tool to make them look like they rotate with the clip. Each of the 5 instances on the stage have different instance names (screen1_mc - screen5_mc).My problem is, after all that frame by frame positioning, ive gone to render out the SWF and its telling me that there are "Multiple 3D objects on the same frame have the same instance name. 3D instance names must be unique. All but one of the instances will be renamed during export."
Soo frustrating. I must have either hit ctrl+v twice on one of my frames or perhaps not renamed the instance after pasting it.. but i cant figure out which frame the problem is happening on. Im really hesitant to have to go through all 360 frames clicking on all 5 of the instances to see which frame is causing the issue.Can anyone think of a programmatical way to figure out which frame has the duplicate instance on it?I was thinking about using an enter frame event to loop through tracing out the frame number, then somehow trace out the instance names and the number of instances of screen_mc that appear on each frame to see which frame has the instance thats been automatically renamed by flash?
I know very basic AS and ran into a small problem. I have a movie clip that I would like to be duplicated when the user clicks on it and then they can drag and drop it anywhere while the original stays in its place. Right now I have that working, the user can drag as many copies as they want, however when you release the clip you are unable to drag it anymore. "x" is my movie clip.
I just read a thread on how to duplicate a movie clip and drag and drop it with AS2. However, I keep getting a syntax error on line 3. Attached is the file.
I wanted to report a problem I've been having with Flash CS5.5 on MacOS 10.5.8 When I drag an element (usually a line or shape) with the alt key pressed (in order to create a duplicate on the stage) sometimes I get a couple of message boxes appear that say "Panel x could not be created removing it from the list" where x is a number like 7 or 9. After I click through these the swatches panel appears in the middle of the screen.
This is quite annoying and holds me up as I have to click through these boxes & then close the swatches panel.
i have been trying to get this to work forever. What im doing here is making a flash site thats like a real time strategy game. You have to build stuff in order to unlock new sections of the site. check out this: [URL] click on build, then drag the Main button and release somewhere above. Notice that when you release it sticks to the cursor and doesnt stop dragging. Now, hit cancel and notice that the main clip is still loaded and works correctly if you drag and drop it.
have a imageHolder_mc wich is calling the image from the local drive / server, and this container is inside of PictureHold_mc and that inside of Image01_btn.image01_btn.pictureHold_mc.imageHold01_mcand all this for 1 image tobe displayed in the website. But I am going to have something like 300. This is for example HomePage to ProductPage to SpecificIndividualProduct.I have created an instance but DO I NEED TO DUPLICATE ALL _btn and _mc all the way down? Or is there any better ways.And next question. I have done Home Page with 18 images called from the local drive but despite of Preloader showing 100% loaded page look empty for about 30 sec. and suddenly all images starts popping out ramdomly.
I'm making a game for children where they have to pay money by dragging it on a square. It al works wel only when i pick the first coin of one euro without going over the coin of 2 euro and then pick up a 2 euro coin the one euro disappears. after then it all works fine. i cant remove my duplicate euro's from the stage when i clic on pay here is my code for the euro's the euro's are in a emty movieclip
I posted earlier about getting a zoom effect which was solved by putting the content within 2 containers: the parent container to center the zooming & the pan container (child) to be panned on drag, however when I drag the child a copy of the original remains for some reason?basically I have this to set up the containers:
ActionScript Code: ParentContainer = new Container(); addChild(ParentContainer);
I have a full page calendar that uses a duplicate movieclip to add the day squares (actionscript adds the day number)
I want to add a target to that "day" movieclip. (I can do this)
Now the part i don't know how to code:
I want to add a star at the top that can be dragged to the target "day". BUT... On any of the days and multiple days.
So i guess the star needs to duplicate movieclip and be able to drag and drop to any of the targets. The target is on a duplicate movieclip itself so the instance name will need to be the same on all days (or i could have it append 1,2.3 ect to the end of the instance name like: target_mc1, target_mc2...)
I need to make movieclip carbondot and its actions automatically duplicate into a new instance after being dragged, but my current coding for carbondot isn't working:
I drag the combobox from the library and set the dataProvider through AS.however, I click the combo, the options show, I click an option but the value doesn't change. it's like I clicked outside or something, it simply stays with the same value there.
example:
[option0][v]
*clicks the v arrow*
[option0][v][code]......
I simply drag the object, give it an instance name and set a dataProvider, nothing else.
I'm making a game for children where they have to pay money by dragging it on a square. It al works wel only when i pick the first coin of one euro without going over the coin of 2 euro and then pick up a 2 euro coin the one euro disappears. after then it all works fine.i cant remove my duplicate euro's from the stage when i clic on pay here is my code for the euro's the euro's are in a emty movieclip
I'm, trying to create a duplicate symbol and then be able to drag the symbol around the screen.I have an image - once converted to a button and on the stage as paddock_btn. The other converted to paddock_mc in the library, with a linkage identifier of "paddock".I want to be able to click the button, and create a duplicate, which can be dragged and placed on the screen.Unfortunately, I don't get any output errors here.
Code:
//create a function to duplicate paddock function dupe_paddock():Void { i = i + 1;
I tried to make a "drag" and "click" balloon which goes up and with a guy who follows the balloon movement through a line.... No prob, it works, but I need to duplicate the balloon 8 times (i want to create a menu with these balloons).... I tried to duplicate it in a for loop, but it doesn't duplicate the string and the guy.... if somebody has a clue I'll take it...
I am having problems dupliating a movie clip. I can make a duplicate from an original but when I edit the duplicate it also modifies what is in the original. (I am just changing the text, thats the only difference between the 2) How come it effects both clips when I only change one?
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
I want to have an image and when I click on the image ,one can hold down the mouse and drag a copy to where ever on the stage and when one lets go, one can drag another and another with each copy still being able to be dragged after released.this is what i have but its pretty simple and doesn't work....
stage.addEventListener(MouseEvent.MOUSE_DOWN,makeA Box); var i:Number = 1; //i will be the total number of boxes var newBox:myMC = new myMC();[code]....