Actionscript 3 :: Drag And Clone MovieClip In It?
Sep 14, 2011I have a toolbar with some cars on the left of the window, and I want to click on one element and drag it to the board creating a clone of it, but I can't do it.[code]...
View 1 RepliesI have a toolbar with some cars on the left of the window, and I want to click on one element and drag it to the board creating a clone of it, but I can't do it.[code]...
View 1 RepliesI have a movieclip that inside have secuence of image, I will like 1000 instances of this movieclip, but I not like reload the 100 of images inside the movieclipIt is posible.That the movieclip have a child share with more objects
View 1 RepliesIn our app, we create complex nested movieclip with code. Essentially, we use lots of loadbytes and addchild to create these complex movieclips. Sometimes, we need to duplicate one of these complex movieclip hundreds of times to create hundreds of instances of it.Currently, we perform the "duplication" by re-creating the complex movieclips from scratch with loadbytes and such. However, this is proving to be very slow.What would be a quicker way to "duplicate" or "clone" a complex movieclip?Is there a way to serialize a complex mc into a bytearray and the resurrect it as a new object with a single loadbytes?
View 2 RepliesHow do I make a clone of a Sprite or MovieClip at runtime? So that if I make changes to the copy, the original remains unchanged.
And you can turn any Sprite or MovieClick in a class? So that I can create instances of this class (using new) and thus create copies of the display objects.
I have a function that states when movieclip1 is dragged and hits a line then it stops the drag, however it seems to stop the entire drag function in the swf on the other movieclips even though they arent called in the function.[code]
View 1 RepliesI Have the drag and drop working where you drag a text movieclip onto a picture of an object movieclip but having some problems. I know its something to do with the hitTest function but when i drop the word "cow" onto the picture of a dog it actually says this is correct by displaying the word cow above the picture of the dog when instead it shouldnt allow me to drop the text onto the picture which doesnt match.
Basically i need to know how to seperate the drag hitTest function for the DogPic/DogText so that it has its own function to detect a hit. At the moment you can see in the below code I have 1 hittest fucntion detecting both collisions when they need seperate functions I tried making a seperate function for each but it didnt work
[Code]...
I am trying to create a mc with drag function. how to change another movieclip's x value when I drag my first mc...
videoSlider.addEventListener(MouseEvent.MOUSE_DOWN, scrollMC);
videoSlider.addEventListener(MouseEvent.MOUSE_UP, stopScrollMC);
private function scrollMC(event:MouseEvent):void{
[Code]....
there's a way to clone a sprite? It's easy enough with a bitmap since BitmapData can be cloned.
View 10 RepliesThis is probably a stupid question with a simple solution but I have been searching with no luck.
I created a shape and added it to the display list calling it arrowBtnL. But how do I take the same shape and clone it to another place on the stage calling it arrowBntR? I did a makeshift and just made the exact same shape again but it seems to unnecessarily take up lots of code lines and is uneconomical. Am I wrong here?
[Code]...
i am using 2 instances of an flv, and as you would expect they arent sync'd.so how do i 'clone' an flv in AS3 so that they are exactly the same?i have seen an example, but it was AS2, i am working with AS3, cs4..[URL]
View 5 RepliesI have a lot of objects that gets loaded to the stage over time. Should I clone the objects that are already loaded or do URLRequest for all of them? Will the engine automatic pull loaded objects from cache if I just do URLRequest?
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Progre ssEvent.PROGRESS, onLoaderProgress);
var fileRequest:URLRequest = new URLRequest("myImage.jpg");
myLoader.load(fileRequest);
fileRequest = new URLRequest("myImage.jpg");
myLoader.load(fileRequest);
I was wondering if it's possible to have 2 selection simultaneously. Let me explain. I wanna be able select a piece of text within a textfield and have that selection-square displayed also on another textfield, using the
Selection.getBeginIndex() and EndIndex();
i.e. I select the 1st 5 characters of my textfield 1 and I have then the 1st 5 characters of my textfield 2 selected simultaneously.
if i have my own custom event class when do i need to call the clone method?
View 3 RepliesIm trying to make a breakout clone which I have working however I cant figure out how to test which side of the blocks the ball hits. I woul like to have a different reaction if it collides with the right side than if it hit the bottom etc.
View 2 RepliesI need to be able to clone an object. The object is not a visual one, only having basic information (strings, booleans and integers). What I want to do is be able to get another object that is identical with the current one. Let me be more specific. I have the class RAM that has some info (like capacity and stuff like that). I have different object with different specs. let's call them ram1, ram2 and ram3.
I want a function that given an object will return another object with the same specs. I can always implement a clone() method inside the RAM class...but this isn't something portable and it won't work with other objects, for example CPUs. Is there any way I can clone an object. I already tried this: [URL] but that returns null.
I need to take a jpg and clone it 200 (can be any number) times. I want the files to all be saved in the same directory but with numbers. Essentially creating an image sequence of one image.
Photo001.jpg
...
Photo200.jpg
Is this possible? The file reference class seems like would ask me each time where to save the file, I clearly don't want that. Ideas?
I am trying to duplicate a flex component at run time. For example if I have this:
mx: Button label="btn" id="btn" click="handleClick(event)"/>
I should be able to call a function called DuplicateComponent() and it should return me a UI component thts exactly same as above button including the event listeners with it.
I've some strange behavior using ObjectUtil.copy() and ByteArray.writeObject/readObject(). I clone an ArrayCollection and sometime the result is two identical instance of the class. Example :
[Code]...
I have created a custom even class which is pretty basic. But when calling an event and then relaying that event to another class I have encountered the "cannot transform thisEvent into thisOtherEvent" error. I realize this is because I needed to override the Clone function in my custom event like so:
[Code]...
i have a website which is basically a omegle copy (text version only) - it connects 2 random users in a chat. I hosted it on a shared hosting and also on a VPS but it "eats" the whole resources when i have 50+ users online. It "refreshes" the page every 2 seconds (its using ajax+php+mysql database). I was told, it could not be optimized any further, only delaying the refresh period. So now Iam trying to make it run many users without this problem, basically i found two options:
Make the chat using node.js+socket.io (or alternatives like APE). I dont have the knowledge and time to make this myself so I asked som freelancers about it - they can make this, but it would cost me $600 (which is too much for me ,Make it using Flash and buy a complete software from this site maybe http://www.chatroulette-clone.com - I can edit it after buying it, so I would delete the webcamera option from it. They say, that it utilizes the newest Flash technology and it should make very little server load.
I'm trying to figure out a way to clone / copy a dictionary object.
I came across some articles on cloning that offer this code.
This does not seem to work for dictionary objects. I think it only really works for basic objects.
Has anybody come across a way of cloning a dictionary before
Code:
function clone(source:Object):*
{
var myBA:ByteArray = new ByteArray();
[Code].....
I do not know how to copy a DisplayObject can anyone can help me on this one? I've downloaded an image from a website at runtime and putting it into a DisplayObject and now I'd like to create a completely separate copy of it so I do not have to make another request to download it again.
View 3 RepliesI can't work out how to create a temporary copy of a 3D point class on which I'll perform some calculations which I don't want to effect the original. In C++ it's called deep copying. How do you do it in actionscript?
[Code]...
with a "small" problem:I can't seem to duplicate or clone a mc created at runtime, with a child mc inside, which is attached at runtime... Here is my file:
View 6 Repliesi've built a little game, where the user can drag and drop objects on a canvas. there's a button wheren the canvas turns black, and the objetcs (images) become white, like a photographic image. What I'm trying to do without sucess until now, it to make the draggable objects infinit, so the user can drag as many objects as he can.
View 1 Replies(I see this same type of question was posted almost three years ago with no resolution, does anyone have a solution now? am trying to save a clone of a custom object (contains arrays and other custom objects as properties) to a Shared Object.Basically I have a menu system that created this program, it's running and at any point I want the user to be able to save it so he can go back to that exact point at a later date. Here is what I do so far:1. Pause the program2. The menu saves the variable that references the running program using a bytearray to a shared object3. A a later time, to load the program I pull the data from the shared object and save it to a variable, which I then treat like the original programHere is my code to save the data:
Code:
var byteArrayCloner:ByteArray = new ByteArray();
byteArrayCloner.writeObject(myProgram);
[code].....
I have this "left half of a door" image in my library, and I did cloned the same image to the stage, making it "right half of a door" but really would like to know what would be the right way of doing such things..[code]Should I just make new instance, or do it through function? Is there a memory issues in one of those, what hurts Flash more?
View 1 RepliesI have a file where there is a magnet being dragged horizontal. When the magnet is on the left there is a electrical current flowing down, when it's at the right the current flows up. What I want is to have the two electrial currents play at certain points during the drag.So in the beginning the 1st current plays, which is a separate MC. Then once the user drags the magnet to the right the 2nd current MC begins to play and the 1st one becomes invisible. Then the cycle needs to repeat once the magnet gets dragged back to the left.[code]
View 2 RepliesIs it possible to drag a movie clip named "xxxx" along the y axis when you click and drag? if so what is the as2 code?
View 1 RepliesI need to drag more than one Mc at the time:
n.b. emc2 is a mc on the main timeline. This code is in a nested MC.
prnt: MovieClip = this.parent as Movieclip;
function drag(e:MouseEvent):void{
if((e.type == "mouseDown") && (GlobalVar.stat == "clicked")){
this.startDrag();
prnt.emc2.startDrag();
} if((e.type == "mouseUp") && (GlobalVar.stat == "clicked")){
this.stopDrag();
prnt.emc2.stopDrag();
GlobalVar.drag = false;
}}
This.startdrag() stop to works when I add prnt.emc2.startDrag().. why?