Deleting A Line And Swapping The Order Of Objects
Hi,
I'm making an interface where a line is drawn between two buttons when they are pressed consecutively.
I have 2 unwanted effects:
1. I want the lines to appear behind the buttons, not be drawnr the buttons.
2. In the next scene, I want to be able to move one button to another point, and the line to still be attached to that button. (I dont want to drag it iosition, i want to enter coordinates into a text input and the button moves there instantly)
If somebody could answer these questions i would be very grateful.
Adam
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 06-05-2007, 01:22 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Z-order Swapping
Using Flash 5...
I've got a clip that moves around the movie stage controlled by keyboard input...think Pokemon or one of the old-school Zelda games...I've been able to use the SwapDepths function to bring the character forward in the z-order as he moves down-screen, but having trouble pushing him BACK in the order as he moves back up and away from the front...any insights?
Recursive Z-order Swapping
Hi all,
I've run into this a couple times, and my lack of a programming background comes back to bite me. Does anyone have a nice, tight algorithm for stepping through an Array of movie clips and reversing the z-order stack?
Using mc.swapDepths(mc2), I need to recurse through a list and re-order them.
I have :
clip1
clip2
clip3
clip4
And I want them to be:
clip4
clip3
clip2
clip1
etc...
Thanks!!
Best case would be one that can run through an Array of n length.
Array Order Swapping Question
Ok, say I have an m-d array with 5 values in each of 10 array rows
data[0][0] thru data[9][4]
What would be the best way to swap the data in say row 3 (data[2][*]) with the data in row 6 (data[5][*])?
In other words, just changing the order of the rows.
Im very "old skewl", and my old skewl thinking suggests I should just create a temp "buffer" s-d array and copy the contents of the first row to the buffer, then copy the contents of the second row to the first, then copy the buffer contents to the second row. But, there's GOT to be a more efficient way!
Any help would be appreciated!
Ahhhk!
Loading Multiple SWFs & Swapping Their Load Order
Hi,
I'm currently working on a project that loads in 5 external SWF files (in the background) using this code:
var mainMCL:MovieClipLoader = new MovieClipLoader();
var mainListener:Object = new Object();
mainMCL.addListener(mainListener);
mainListener.onLoadInit = function(target_mc) {
target_mc._visible = 0;
};
mainMCL.loadClip("external/01.swf", holder.sec1);
mainMCL.loadClip("external/02.swf", holder.sec2);
mainMCL.loadClip("external/03.swf", holder.sec3);
mainMCL.loadClip("external/04.swf", holder.sec4);
mainMCL.loadClip("external/05.swf", holder.sec5);
Each of the 5 external files will be quite large in file size. My question, if a user selects a section from the main navigation before if has loaded how can I prioritize that section to load first but still continue to load the other files in the background?
Hope you can help!
Kind regards
Mark
Swapping Objects
I'm currently working on an FPS type game in Flash, I have the basic parts completed, but now would like to advance it a bit, and allow the player to swap weapons.
Unfortunately, I have no idea where to start, and was wondering if you guys could recommend any good tutorials, just on the basics of swapping movieclips etc. or even explain some code, if you have the time.
Any help is greatly appreciated!
George
[F8] Deleting Objects
hi!
I'm making a game and I need some help . I don't think it's necassary to go into all the details. So here's the problem. I have made a class. In this class I have some properties of raw data (String, Numbers and such). I also have a propert holding a MovieClip. Now for the sake of optimizing I want to remove the entire object after using it. In my code I use the
PHP Code:
delete this;
statement to delete the object. But it does'nt work at all! It keeps returning false. So for now I use the
PHP Code:
removeMovieClip(this.container);
method just to get rid of the graphical appearance. But does anybody know why I can't delete an instance of this class? Here's the class:
PHP Code:
class ActionInterface {
// properties:
private var container:MovieClip;
private var menu:String;
private var args:Array = new Array();
private static var ELEMENT:String;
private var point:Object = new Object();
//constructor:
public function ActionInterface(menu:String, mc:MovieClip, args:Array) {
if (ELEMENT == undefined) {
trace("ERROR: element is undefined!");
break;
}
this.menu = menu;
this.args = args;
this.container = _root.createEmptyMovieClip("container" + this.menu, _root.getNextHighestDepth());
this.point.x = mc._width;
this.point.y = -2 * (mc._height);
mc.localToGlobal(point);
this.container._x = this.point.x;
this.container._y = this.point.y;
var am:ActionManager = ActionManager.getInstance();
var actionsArray:Array = am.getActionMenu(this.menu);
this.loadUI(actionsArray);
}
public static function setElement(element:String):Void {
ELEMENT = element;
}
// methods:
public function loadUI(actionsArray:Array):Void {
var objRef:ActionInterface = this;
for (var i:Number = 0; i < actionsArray.length; i++) {
this.container.element = this.container.attachMovie(ELEMENT, ELEMENT, i);
this.container.element._y = i * this.container.element._height;
this.container.element.action = actionsArray[i];
this.container.element.element_txt.text = actionsArray[i].getDesc();
this.container.element.onPress = function() {
objRef.executeCommand(this.action);
};
}
}
public function unloadUI():Void {
removeMovieClip(this.container);
trace(delete this);
}
public function executeCommand(action:Action):Void {
if (action.getRoot() == "Lopen naar") {
trace(" ");
trace("commencing move...");
trace(" ");
var user:User = User.getInstance();
user.goToRoom(action.getDesc());
}
this.unloadUI();
}
}
Deleting Objects?
Hi i have been creating a little game which uses objects and have hit a brick wall! Im stuck!
I am creating the objects like this which is creating objects from Target.as
Code:
function creatobjects(){
for (i=0; i<20; i++) {
//i could be used for an id
var target = new Target(50, 50, 5, i)
}
}
so effectively i am making 20 objects...
However when i want to delete the objects i cant seem to figure out how to do it?
Code:
function deleteobjects(){
for (i=0; i<20; i++) {
delete target
}
}
They create fine i ahve 20 differnt objects floating around on the screen but when it comes to removing them i cannot get rid of them. Am i creating them wrong or is there a way that i can remove them all in one swoop?
thanks for any hellp in advance.
Deleting Objects
Hello, I have an array with multiple instances of (same named) sprite objects. They all contain their own children.
I want to delete one of the objects and all of its children.
Do I simply use "splice" to delete the relevant array index ?
Will this then make the spliced object and all of it's children elligible for garbage collection ?
Thanks for any advice / confirmation
Deleting Objects
Hello Everyone,
I'm in the midst of creating a card game, Everything is going well except
this one thing I will explain in a sec.
I'm creating a CardClass, which picks a card from an array and converts it
to a card object. that's fine..it work brilliantly.
However, when a round ends I would like to remove all the cards on the
screen, but for some reason, it won't delete or remove the object.
when I call the function to create a new CardClass it works like this.
for (i=1; i<53; i++) {
newCard(i);
}
function newCard(ID) {
this["card" + ID] = new CardClass (ID);
}
function CardClass(id) {
this.id = id;
this.nextCard = newDeck.pop();
this.addCard(this.nextCard);
}
it then proceeds with prototypes to add functionality to the card which is
being attached form the library.
To remove the card I've tried
for (i=1; i<53; i++) {
this["card" + i].removeMovieClip();
// delete this["card" + i];
}
I've tried both ways. Any help?
Appreciate it
Deleting All Shared Objects
Is there a way to delete all shared objects under one domain via action scripting? - my flash is being run locally and it generates shared objects based on the file name the user selects... i want to be able to delete all of these files via action script. any suggestion(s) is appreciated. thanks
My Sound Objects Are Deleting My MCs
Hey there
I have managed to come up with another stupid problem in flash!!
I have a lot of different Mcs in my file and some sounds are attached to them, everthing was going fine until I decided to use different sets of sounds,
when I replaced them some of my MCs have disappeared( it seems that new sound objects somehow deletes some of my MCs!!) I don't know if this makes any sense to anybody here but I can't manage to figure out what's causeing this. all of my sounds identifiers have unique names so this shouldn't be the problem, the old sound objects have been unattached and I can't think of anything esle. Anyone has any idea what might be the problem?!!!!
Many thanks in advance.
Deleting All Objects In Root
is there a simple way to remove all the movie clips in the root, besides removeMovieClip() for each one individually?
Deleting All Objects On Stage
Hi guys,
sometimes AS3 keeps driving me mad. In my application I have a function which indicates the application to restart. As everything in the application is built by classes, I used weak references for the listeners in these classes. So far, so good. Removing everything from the stage works fine as well, BUT also I used the weak references the garbage-collection doesn't kill all of the objects.
Is there any way to definitely kill all the objects that are currently on the stage including all their listeners or pointers?
Thx for any reply
hellslawyer
Issues Deleting Objects
I can't exactly understand what I'm seeing when my project fails to completely delete objects. It's my fault in the end for how my objects are designed (Using Sandy3D, so objects are nested within other objects which in turn are made of yet another nest of objects and on and on..), but it's killing me now because where I think I'd done all there is to do to delete the object, it still remains.. So I figured my best bet is to get a better idea of how the code is working so I may understand where to go in my code to correct my issues. SO I have a few questions:
1. When you create an object, the variable name doesn't hold a block of memory, right? Its just a reference to said data. So if I were to do something like, say:
Code:
// ///////// AS file 1...
var someObj:SpriteExtendedClass = new SpriteExtendedClass();
someObj.x = 23;
someObj.y = 633;
someObj.someOtherVar = 123.4567;
// ..... set some more variables, etc..
someStaticClass.staticSPC = someObj;
// /////// AS file 2...
// within earlier mentioned static class...
public static var staticSPC:SpriteExtendedClass;
// ...... other static variables, obj's, etc..
would that not only send a reference to the memory where someObj is stored? Or does it make an exact copy of the object itself and store it in staticSPC?
2. What does the removeChild function actually do, besides remove the object from being a viewable part of the stage? Does it delete the memory used at all?
3. What does setting one of these variables (staticSPC or someObj) to 'null' actually do? Does it just kill the link the pointer has to that chunk of memory? Or does it delete the memory?
4. Based on the questions I have here, is there anything you can think of to tell me that may help me out? Something I may not understand that may explain away all of my problems? lol. Because obviously I'm lost and I'm sure that tidbit of knowledge would take me quite a ways right now..
Thanks all for the help
Masks Using AS? Deleting Objects With AS?
How do I put a mask over object1 using AS?
How do I delete an object (named object1) using AS?
The function deleteMovieClip(object1) only works for movie clips that have been loaded by AS, but this certain movieclip is already in the stage.
Deleting Shared Objects
Hey
I'm using the projector Screenweaver 3. Whenever an exe created using Screenweaver is launched, a shared object (sol file) is created. These shared objects are called "SW3_xxxxxx.sol" where xxxxxx is a random number. Is there a way to delete the surplus SOs using actionscript?
Deleting Shared Objects ?
Hi there!
I'd like to know if there's any way to delete a shared object from the HDD through AS or to set all of its properties to null or undefined. The documentation says: "If null or undefined is assigned to an attribute, Macromedia Flash MX deletes the attribute.", but this is for an attribute. I'd like to delete the shared object itself and be able to create a new one...
I've tried: MyObject.data.MyVariable = null; and when I trace the attribute's value later in my movie, it still has the first value I entered for it !!. No deletion occurs!
Is there an easy way to do so ?
Thanks in advance,
Spongebob
Deleting Objects From Library
hello everyflashin bodies )
i found that Flash MX deleting objects from library incorrectly..
i have imported into projects a lot of jpegs, the size of the project became something about 50 Mb.
than i have deleted them from library, but the size remains the same - 50 Mb...
who knows what with this?
Deleting Objects / Arrays
Hi all,
I have several large arrays sat in _root, and I want to be a good coder and clean up after myself when I don't need them any longer.
I cannot find any kind of "delete" keyword.
The best I can do is assign "null" to the array variable, but I am dubious as to whether this is deleting the actual array object as arrays are reference objecst.
Does Flash have some kind of garbage collector like Java?
Cheers,
Lister
Deleting Custom Class Objects?
Ok, forgive my terminology as i am new to Flash's take on Object Oriented Programming.
Now, i have my Class in an external AS File, i create an object of it via Strict Data Typing.
Now i am using my object to hold data for a animation from my navigation bar, anytime anyone clicks a link this animation is executed, and thus the class object is executed. (It holds such things as target x, speed, ect..)
Now what i am wandering is how i can delete this object when i am done with it, as just in c++, i assume these objects take space in memory. Even though the space is minimal, it just bugs me to leave open ends like this.
So, in short, with strict data typing my object (var blah:MyObject ect..), how can i delete it when i am done with it?
Thanks to any replies!
[F8] Deleting Objects And Freeing Memory
I'm making a video game where you have a turret that fires multiple bullets. Each bullet is an composition object that stores a movieclip and some properties such as a desination x and y, an angle for direction and a speed. Once the bullet reaches it's destination I want to delete it so it doesn't stay in memory. I've tried using delete this, delete this.onEnterFrame, this.removeMovieClip but when I use the debugger it still show all the instances in memory. Given that in a single game session the user could easily exceed 1000 bullets this thing will become a huge memory hog. Here's the class definition code.
code:
class Bullet
{
private var pTargetClip:MovieClip;
public function Bullet(targetClip:MovieClip)
{
pTargetClip = targetClip;
}
public function shoot(destx:Number, desty:Number, angle:Number, speed:Number):Void
{
var dx, dy, spd:Number;
dx = destx;
dy = desty;
spd = speed;
pTargetClip.onEnterFrame = function()
{
if (this._y <= dy)
{
this._visible = false;
delete this.onEnterFrame;
}
else
{
if (dx > this._x)
{
this._x += spd*Math.cos(angle);
}
else
{
this._x -= spd*Math.cos(angle);
}
this._y -= spd*Math.abs(Math.sin(angle));
}
}
}
}
And here's the code in the main timeline that references the class.
code:
var myBull = new Bullet(this["b"+shotnum]);
myBull.shoot(destx, desty, angle, 10);
If I put a trace just before the delete this.onEnterFrame it keeps going, implying that the delete this.onEnterFrame is being ignored.
Deleting Objects From The Papervision Scene.
Hello guys! I´ve got a basic problem with Papervision :_ I´m trying to create and then delete planes from the scene. I was using 1.7 version until I noticed there were not destroy method inside the materials classes so this is my first attemp using Papervision 2.
What I have done to test it is using Papervision2.com Basic Interactive tutorial example. In this, I´m creating 50 planes in the stage and adding them the erase method onMouse Down, here is the code :
// Creating planes..
override protected function init3d():void
{
ourMaterial.interactive = true;
ourMaterial.doubleSided = true;
ourOverMaterial.interactive = true;
ourOverMaterial.doubleSided = true;
for(var i:Number=0; i<50; i++){
planeArray[i] = new Plane(ourMaterial, 1000,1000, 2, 2);
default_scene.addChild(planeArray[i]);
planeArray[i].addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _onPress );
planeArray[i].x=Math.random()*800
planeArray[i].x=Math.random()*600
planeArray[i].z=Math.random()*10
planeArray[i].rotationX=Math.random()*360
planeArray[i].rotationY=Math.random()*360
planeArray[i].rotationZ=Math.random()*360
}
}
// OnPress Event...
private function _onPress( e:InteractiveScene3DEvent ):void
{
trace("before destroying plains numChildren is",default_scene.numChildren);
for(var i:Number=0; i<planeArray.length; i++)
{
ourMaterial.destroy();
planeArray[i].removeEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _onPress);
default_scene.removeChild(planeArray[i]);
planeArray[i]=null
}
planeArray.splice(0, planeArray.length);
trace("after destroying planes numChildren is",default_scene.numChildren);
}
//end
My problem is that I really can´t delete the objects from the Scene, when I request numChildren it display the total amount of planes I placed into the scene. Does anyone know how can I delete objects from the stage? Any Ideas? I´d appreciate any comments.Thx in advance
Best Regards
Clau!
Deleting Objects From The Papervision Scene.
Hello guys! I´ve got a basic problem with Papervision :_ I´m trying to create and then delete planes from the scene. I was using 1.7 version until I noticed there were not destroy method inside the materials classes so this is my first attemp using Papervision 2.
What I have done to test it is using Papervision2.com Basic Interactive tutorial example. In this, I´m creating 50 planes in the stage and adding them the erase method onMouse Down, here is the code :
// Creating planes..
override protected function init3d():void
{
ourMaterial.interactive = true;
ourMaterial.doubleSided = true;
ourOverMaterial.interactive = true;
ourOverMaterial.doubleSided = true;
for(var i:Number=0; i<50; i++){
planeArray[i] = new Plane(ourMaterial, 1000,1000, 2, 2);
default_scene.addChild(planeArray[i]);
planeArray[i].addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _onPress );
planeArray[i].x=Math.random()*800
planeArray[i].x=Math.random()*600
planeArray[i].z=Math.random()*10
planeArray[i].rotationX=Math.random()*360
planeArray[i].rotationY=Math.random()*360
planeArray[i].rotationZ=Math.random()*360
}
}
// OnPress Event...
private function _onPress( e:InteractiveScene3DEvent ):void
{
trace("before destroying plains numChildren is",default_scene.numChildren);
for(var i:Number=0; i<planeArray.length; i++)
{
ourMaterial.destroy();
planeArray[i].removeEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _onPress);
default_scene.removeChild(planeArray[i]);
planeArray[i]=null
}
planeArray.splice(0, planeArray.length);
trace("after destroying planes numChildren is",default_scene.numChildren);
}
//end
My problem is that I really can´t delete the objects from the Scene, when I request numChildren it display the total amount of planes I placed into the scene. Does anyone know how can I delete objects from the stage? Any Ideas? I´d appreciate any comments.Thx in advance
By the way! I know maybe there would be problem using just one material and destroying it on the itteration, but anyway, I also tried with just one plane and I couldnt delete it :_
Thx
Best Regards
Clau!
Two Objects Conected By A Dinamic Line + Physics Of The Line
Hi
I have two Movie clips, and I have to conect them with a dinamic line, like a rope. The movie clip A will be interactive with the mouse, changing X and Y positions, so the line should act like a rope.
Does anybody knows some code to do that or have a example?
Deleting Shared Objects On Application Load
Hi, I am using a whiteboard application that stores drawings as shared objects on the server. When you start the application and make a connection to the server all of the shared objects drawings load. I want the shared objects slots to be cleared as a user connects or at least be able to clear them myself from time to time. I have tried deleting and editing the .fso file, but it is simply recreated with all shared objects at application startup. My shared object code is below, it stores images with slot names based on the position of the mouse.
function initSharedObject() {
main_nc = new NetConnection();
main_nc.onStatus = function(info) {
if (info.code == "NetConnection.Connect.Success") {
drawing_so = SharedObject.getRemote("drawing", main_nc.uri, true);
drawing_so.onSync = function(list) {
for (var n in list) {
var line_obj = this.data[list[n].name];
draw_mc.moveTo(line_obj.x1, line_obj.y1);
draw_mc.lineTo(line_obj.x2, line_obj.y2);
}
};
drawing_so.connect(main_nc);
} else {
trace("ERROR: " + info.code);
}
};
main_nc.connect("rtmp:/drawing");
}
How do I clearout the shared objects?
Thank you for your help.
Strings Panel Deleting Text + Removing Line Breaks
Does any one have a solution to the strings panel deleting text when using it for multilanguages? (I have tried the 7.2 upgrade. It still is not stable.)
Also it is removing the returns (line breaks) from my lovely formatted dynamic text boxes. Something a client won't put up with. Any solutions to this?
regards
Z ORDER OF OBJECTS
Hi,
I am creating a portfolio where all of my images are being loaded from an xml doc. The thumbail loader is being loaded into level0, my problem is that all of the images are being loaded over my UI assets that are already on stage. Flash is not respecting the Z order of my layers and my conflict is created because both my main timeline and my dynamic movieclip holders are both on level0. How can I move the thumbnails below my UI assets. You can see my problem if you go to http://www.techntoon.com/portfolio7.swf and click on any thumbnail you will see the large image appears over my nav bar.
Thanks.
Flash App. To Order T-shirts On-line
T-Shirt manufacturers are using a Flash App. created "Design Window" to allow one to "design" their own T-Shirt:
1. Select Style of shirt
2. Select color
3. Add type in selected color
4. Add (upload) custom art or choose from stock art (shown on site)
5. Move all objects around on shirt
6. Save design and place order
Are their "stock built apps." available to customize?
Thanks!
Greg
Accessing The Tab Order Of Objects
Hello,
I am having difficulty determining the identity of the next object in the tabbing order. I set the tabIndex of a group of text fields as they are attached and upon running the app the tab key works as expected. However, another requirement is that upon a condition (say length of field reached while typing) I want to actionscript to move the focus to the next text field in the tabbing order. The problem is I don't know what field that is.
getFocus() will return me a tabIndex of the field I am on. But setFocus() wants an object name. focusManager has a nextTabIndex property but there again, just a number. I could build my own array of objects as I set the tabIndex, but that seems a little clunky and operates independently of Flashes handling of it.
I understand this functionality was meant for use with the tab key, but it sure would be nice to query against wherever Flash has stored its reference to objects in tab order. Is that possible? Or is there another way to approach moving the focus the next field without requiring a tab keystroke?
Thanks for any help you may provide.
Changing The Order Of Movie Objects
i'm trying to switch a movie from the backfround to the foreground position so that it is in the top most position for special condition. Is there any way to do that with script so that it is changed in runtime?
thanks,
joebe
Linking Order Of Objects To Animation
hi, im pretty new to flash, hope someone can help.
i need to create an application that allows kids to drag graphical blocks, representing directions, to an area on the stage, and if the blocks are placed in the correct order, an animated car will take the correct route around a course; the blocks are more or less representing elements of a program, and if its placed correctly, the animation will be carried out, else error messages will be displayed. can this be done in flash 8, which is the version i have, and would there be much work involved?
Reverse Line Order In Textfield Hebrew Problem
hi ,
does anyone know how to reverse line order in textfield?
(text is loaded to textfield dinamicly)
example: textfield shows those lines:
line 1 : hi there
line 2: whats up?
line 3: keep on flashin`
how can i reach this result ?:
line 1: keep on flashin`
line 2: whats up?
line 3 : hi there
i need this cause i load hebrew text dinamicly - i solved all problems regarding this but im stuck in the reverse line problem...
Checking The Locations Of Multiple Objects And Their Order
Hi, this is my first post and I hope you guys can help me out.
I have a pretty decent understanding of Actionscript so I don't think I should have too much trouble understanding your help.
Well, the idea for a thing I'm doing is that I have several objects that can be dragged and dropped along the bottom of the screen.
I have 8 placeholders across the screen also and I want the user to drag the 8 objects into these places and then the script will check to see if they are in the right order, left to right, and which object is in which postition.
I have 8 Movie Clips as the placeholders and my script will use their x and y values +&- around 50 (so I can change the positions easily If I need to) to determine if the dragged object is within a certain area around it and then it tweens the object to the center of the placeholder in effect locking it in place. I have that down fine.
What I would like to know is what the best way to determine which object is in each placeholder so I can check if the user made the correct answer and display on a results page which order the user places them in vs the correct response.
I have ideas of how to do it but they involve alot more script than what I think I need, I'm pretty sure there has to be an efficient way of doing this, perhaps using arrays in some way.
Thanks in advance.
PS: Is their a way to have looping music continue across scenes? I know you'll probably say don't use scenes but If it can be done with scenes I'd prefer to do it that way.
Attaching A Line's Endpoints To MC's That Move Dynamically, In Order Of Usage?
I have several MC's on the stage that all move dynamically based on delivered x/y coordinates. All these MC's have onRelease actions.
What I would like to have happen is to have a line attach from MC to the next MC selected in whatever order they are released.
For example you release any MC. Then when you release another MC a line is attached to the first MC and second MC, "connecting" the two. Then when you release a third MC, a line is attached to the second MC and the third MC.
the reason I refer to the line as being "attached" to the MC is because I want the line's end points to move with the MC's it is attached to.
Does anyone know how to do this? Or can point me in the right direction?
THANKS
[MX04] Simple Code, But In Which Order Are Objects Created ?
Hi,
I have a really simple example but as simple as it is, it does not work (I am using MX 2004).
I create a movie clip in the library. It has got two layers:
1. a small black square, initially 10x10
2. an action layer with the following code:
Code:
stop();
function setHeight(h:Number)
{
trace("setHeight");
this._height = h;
}
function setWidth(w:Number)
{
trace("setWidth");
this._width = w;
}
I dragged the movie clip on the stage and named it blackSquareMC.
The following code works fine:
Code:
_level0.blackSquareMC._width = 100;
while this does not have any effect:
Code:
_level0.blackSquareMC.setWidth(100);
It seems the function is never called. I suspect it is due to how objects are created in Flash.
Could anyone help me with the basis, please ?
Many thanks,
Kz.
How To Prevent "target Swapping" Of Overlapping Objects?
I'm working on creating a top-down product configurator or sorts, which is basically a grid with draggable objects. MOUSE_DOWN starts the drag of an object on the screen (calling a MOUSE_MOVE event) and MOUSE_UP stops the drag of an object. In this way a user can re-arrange any targeted object on the grid.
The problem is, when I drag objectA over objectB (which was placed on the grid earlier), they sometimes swap indexes (I'm assuming) and objectA will stop while objectB will begin dragging. The fact that the objects are of different dimensions only makes this worse. How can I prevent this from happening?
I thought about using setChildIndex() but I don't see how I can make that work since the top-most item has the highest index value (if you have 5 things on the grid, the top one will have an index of 4 if I'm correct). The problem is I have an unlimited number of objects that can be placed on the grid, so I have no idea how I could figure out the highest index value.
Anyone have any ideas?
How To Prevent "target Swapping" Of Overlapping Objects?
I'm working on creating a top-down product configurator or sorts, which is basically a grid with draggable objects. MOUSE_DOWN starts the drag of an object on the screen (calling a MOUSE_MOVE event) and MOUSE_UP stops the drag of an object. In this way a user can re-arrange any targeted object on the grid.
The problem is, when I drag objectA over objectB (which was placed on the grid earlier), they sometimes swap indexes (I'm assuming) and objectA will stop while objectB will begin dragging. The fact that the objects are of different dimensions only makes this worse. How can I prevent this from happening?
I thought about using setChildIndex() but I don't see how I can make that work since the top-most item has the highest index value (if you have 5 things on the grid, the top one will have an index of 4 if I'm correct). The problem is I have an unlimited number of objects that can be placed on the grid, so I have no idea how I could figure out the highest index value.
Anyone have any ideas?
I Can Not See The Objects In Time Line
Need Help!!! I Got a Flash movie in the form of .fla file when in run this movie in the plyer it completely runs but when i search the item at the end of the movie through time line i can not find those object or items.....However when i run the movie and those items which i can not see in the time line start to run in the player this error message displays "A 'with' action failed because the specified object did not exist."..Now i want to edit those items (Texts, shapes etc)...How can i do this please help...
Ehsan
Moving Objects Along A Line?
i've been using motion tweens to animate my movies and i'd like to reduce the size by using actionscripting to achieve the same effects. can anyone suggest any tutorials that will take me through the basics of using actionscripting to move objects along a line?
here's my current website and the first 20 frames are nothing but motion tweens. any suggestions on how to reduce the load up time??
http://web.mit.edu/jbradd/www
HOW: Connect Line Between To Objects
hi,
i got 2 objects (lets say balls) in my movie.
i want to connect a line between them and while they're moving, the line dynamicly moves/grows with them.
now, i got the x,y of the line (the upper left point) but what about the x2,y2 ( the bottom right point) , how can i get it and control it?
thanks in advance, Avi.
Dynamic Line Between Two Objects
Hi,
I saw a post earlier that was along the lines of this, but it didn't work for me, so here I am.
I want to create two objects (Movie Clips I guess would be the best bet), and have a dynamic line exist between them. I then want to be able to, once the animation is running, click and drag on either MC and have the line re-draw itself so that the line always exists between the two MCs, no matter where I move them to on stage, and no matter how far apart.
Is this possible, and what would be the code if, for example, one movie clip was called "MC1" and the other "MC2"?
Any help here would be much appreciated.
Line Connecting 2 Dynamic Objects
Hi
Can someone explain in detail and laymans terms how to dynamic link two objects with a line, and keep the line connected as the objects are moved around
thanks
Line Connecting Objects Revisited
Hi
Thanks to zaxis for the code below, 2 things
1. How would I have a number of these. Say a row of static
objects on the left hand side, and a row of static objects
on the right. I could then drag a connector from any of the left hand side objects and place it onto any of the right side objects, drawing a line in between and where it would stay until moved.
2. Also how could I get the lines to retract or bounce back to their starting position if not connected to any the hot spots on the right hand side.
I want to recreate the experience of wiring up and testing
an electrical circuit
Thanks in advance
just add two movie clips on the stage and name them "bob_mc", and "mike_mc"
code:--------------------------------------------------------------------------------// two movie clips names bob_mc and mike_mc
// set them up to be draggable
bob_mc.onPress = function(){
this.startDrag();
this.onMouseMove = function(){
var my_mc = _root.createEmptyMovieClip("_line", 777);
my_mc.clear();
my_mc.lineStyle(1, "0x000000", 100);
my_mc.moveTo(bob_mc._x, bob_mc._y);
my_mc.lineTo(mike_mc._x, mike_mc._y);
updateAfterEvent();
}
}
bob_mc.onRelease = function(){
this.stopDrag();
delete this.onMouseMove();
}
mike_mc.onPress = bob_mc.onPress;
mike_mc.onRelease = bob_mc.onRelease;
Line Connecting 2 Dynamic Objects
Hi
Thanks to zaxis for the code below, 2 things
1. How would I have a number of these. Say a row of static
objects on the left hand side, and a row of static objects
on the right. I could then drag a connector from any of the left hand side objects and place it onto any of the right side objects, drawing a line in between and where it would stay until moved.
2. Also how could I get the lines to retract or bounce back to their starting position if not connected to any the hot spots on the right hand side.
I want to recreate the experience of wiring up and testing
an electrical circuit
Thanks in advance
just add two movie clips on the stage and name them "bob_mc", and "mike_mc"
code:--------------------------------------------------------------------------------// two movie clips names bob_mc and mike_mc
// set them up to be draggable
bob_mc.onPress = function(){
this.startDrag();
this.onMouseMove = function(){
var my_mc = _root.createEmptyMovieClip("_line", 777);
my_mc.clear();
my_mc.lineStyle(1, "0x000000", 100);
my_mc.moveTo(bob_mc._x, bob_mc._y);
my_mc.lineTo(mike_mc._x, mike_mc._y);
updateAfterEvent();
}
}
bob_mc.onRelease = function(){
this.stopDrag();
delete this.onMouseMove();
}
mike_mc.onPress = bob_mc.onPress;
mike_mc.onRelease = bob_mc.onRelease;
Drag And Drop Objects With Line Between
Hey all, I'm new here.
I was wondering if there was anyway to put a line between two or more dragable objects...
The only example I can think of is metroidprime.com.
Thanks,
Adanufgail
Bouncing Objects On A Diagonal Line
hi, i want to bounce a object on a diagonal line
i have already maged to bounce an object on a sreight line but i cant do it on a diagonal line.
Drag And Drop Objects With Line In Between
Good evening!
First of all, i'd like to thank everyone that will spend a little time reading this
So, here is what I have to do:
Got a square that duplicates itself and draws a line between itself and the duplication of itself.
The squares are dragable and that part is working fine.
The prob is that, I need the line to travel around with the squares (both of them), and tried a thousand times to adapt some actionscript i found in the net to my fla file, but it just won't work.
The squares duplicate, the line draws, but i won't move with the duplicated not the original square.
PS: i can always show to file to someone who knows a little more than i do about this
|