ActionScript 2.0 :: Using The Equillibrium Code That Centers An Object Between 4 Other Objects
Aug 19, 2004
i've been using the equillibrium code that centers an object between 4 other objects, but when you put the 4 objects inside of another symbol i messes up and i have all the roots right. If you look at the .fla you will be able to see how easy the code is ( its in the square) but it wont work.kirupaForum
Got to the point where the hole in my AS3 knowledge is getting large!Realising I have confusion about the relationship of:Body of code on first frame of AS3 file.(Which I have so far used to create instances of library objects using addchild and make calls to class code).Is this code called the document code? What do people call it?Numerous classes linked together by extending each other etc.Library objects (usually graphical objects)Should it be done differently? have the following problems due to lack of understanding:Addchild complicated from a class but straight forward in main body code.Cant call functions on the main body code from classes, because class code does not know the main body code exists?
In Flash CS3 is there any way to scale a large number of symbols (each on their own layer) at the same time, about each symbols own center. For example after scaling down, every symbol is smaller but it's x,y position has not changed.
did someone else encounter this problem? I use the methods PopUpManager.createPopUp() and PopUpManager.centerPopUp() to create and center a pop up window but it looks strange, like the window is created at (0,0) and then reappears in the middle of the screen. how do I fix this?
I've been fighting this one for weeks - I've tried changing the Document Properties, Publish Settings, and even placing huge white boxes behind the clips I want to preview ... all to no avail! What gives?
Basically, whenever I'm inside a nested movie clip, and Test Scene (Control-Alt-Enter), the animation is centered in the upper left of the stage, so I can only see the bottom-right quarter of the animation - the rest is off-stage and not visible!
As stupid as my question might sound, i have spent the last 2 weeks reading oop books; but could use some guidance. I have a flash project that is basically a supped up slide show. On the stage i have the following: main_mc (instance name = images_mc) = movieclip which holds "pictures" ui1 (instance name = ui1_mc) = user interface that allows user to draw on picture (when drawing is enabled) ui2 (instance name = ui2_mc) = activates invisible hit areas (buttons) on select pics, when hit area is clicked, we jump to another pic in the main_mc.
I accomplished all of this on the timeline, but am updating the code to OOP. I am having A HELL OF A TIME trying to figure out how to store references to the instances (images_mc etc..), so i can control them from varying class files. I have found it is easy to control the instances from the documentclass, but not from unrelated class files. Example: images_mc.stop(); works in document class; but ovieclip(Parent).images_mc.stop() doesn't seem to work from any class file.(ui2 class file for example);
I am encountering a problem in my app only when it is run in flash player 10.1.85.3. Some earlier player versions I have tried are working fine.From what I can tell it seems related to the following:
Quote:
from here: h[url].....
When searching for objects (not strings) in Dictionary objects using the 'in' operator, if the object is not found in the Dictionary object, it will be searched for in the delegate objects. With 10.1, the toString operator will be called on the Object if not found in the Dictionary. This can cause problems with Proxy objects who need to define the callProperty function or it will generate a RTE. ...what it means "it will be searched for in the delegate objects"?
Inside the attached .rar Two seperate objects are made, object A and object B, but they share the same variable (only works with arrays) even though they aren't linked in any way. Any changes made to A is reflected in B, and vise versa.
How would I go about fixing this issue? (SIMPLY, aka I don't want to write a class or whatever, I just want to know if I am doing something wrong, like not writing new or something)
I'm trying to take into account the Garbage Collector (GC), so I decide to optimize this code:[code]For instance, is it useful to put "xmlOne = null" in every iteration? I'm checking with the Flashdevelop's profiler, but I don't see the difference.maybe, I can also reuse the item object rather than creating it every time, right?
When I'm laying out objects on the code, I noticed that I'm having a hard time getting things to stack properly. I know that I need to be dealing with the index property, but I don't know how.
What are some properties, methods etc that can help me easily move around my objects on the stage and visually stack them properly? (Also, can multiple objects have the same index?)
im trying to use a use a code segment that makes something avoid the mouse. My issue is the code requires that iff i have more than one object that i want to avoid the mouse than i need to make a new set of variables for the second object and pretty much copy the code than change the variable names. Thats all great and dandy but i have a couple hundred very small objects that i need to avoid the mouse. is there any way to maybe apply the code to each object with an onclipload maybe?
ActionScript Code: import flash.events.Event; stage.addEventListener(Event.ENTER_FRAME, fun); function fun(event:Event) :void {
[code]....
as you can see the object i want to move requires its own variables and 2 if statements. and i REALLY dont want to have to copy/paste that code over 200 times and make a new set of variables for each object. maybe i could apply the code to the object itself ? but than what would i name the variables?
I created a new flash ide project and used a document class named 'Main.as'. Then I created Main.as file. I then drew a box and converted it to a movieclip and used export for actionscript on it. I assigned the square box in the flash ide the instance name 'box1'. Below is my Main.as file[code]...
I'm creating mc's during runtime like this: for (var i:Number = 1; i <= pictures; i++) { this.attachMovie("box_mc", "box" + i+ "_mc", this.getNextHighestDepth()) }
So, if pictures is 5, then we end up with 5 boxes, box1_mc, box2_mc, box3_mc and so on. But I can't work out an easy way to refer to them later on. For example, say someone presses a button and I want to move all of them - how can I set their _x value in a loop? For example, if I wanted to move all of them 100 pixels, then this wouldn't work: for (var i:Number = 1; i <= pictures; i++) { "box"+i+"_mc"._x = "box"+i+"_mc"._x - 100; }
I need to find out how i can add those same movie clips on the main timeline with code..So i need to figure out how to take objects from the library and add them on stage (main timeline) using code..
Code: // Drag a piece of garbage. rubbish_mc.onPress = function() { this.startDrag(false); }; // When the garbage is dragged over the trashcan, make it invisible. rubbish_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == trash_mc) { rubbish_mc._visible = false; change_score(); } };
My question: I have numerous movie clips for the rubbish. Is there a more elegant way of calling them than repeating the above lines with rubbish2_mc, rubbish3_mc etc.
I tried something interesting recently. I had code effecting an object with the instance name : object_mc.Now I added another object and gave it the same instance name.The result was, that the code only effected the most recent added object (no error).Is there a way in flash to have multiple objects with the same instance name all being affected by one piece of code?
i want to improve my code for drag drop seven different or multiple objects to be moved in any three of target places then target value will be search by category or feature wise,[code]
I am developing an isometric rpg engine in flash AS3. I have decided to separate the engine code completely from the game data, which is in xml. So I have all the maps in xml files, all the quests and npcs etc. My question is when to parse the xml into actual Actionscript code. Should I do this at the start of every play session? Should I only parse the maps as they are called? This is like start up code. For example, I want to parse every tile into a tile object, then draw it to the map. Also, I want to parse the quests in the xml into quest objects so that they can be accessed by other code. So, when should I do this??
I purchased this Thermometer flash template everything works well data is being populated through an xml file but I want to put multiple Swf files on a page with different data.Is there a way I can use SWf Objects.js to call a flash var of the XML file in the browsers source code.This is the Action Script Code
ActionScript Code: stop(); import caurina.transitions.Tweener;//import tween class stage.scaleMode = StageScaleMode.NO_SCALE;//define how stage scales
I have an object that I want to rotate in 3D (letter "Y"). I have some code that I gathered and edited a bit, but right now it rotates at the top left as it's anchor. I'm trying to get it to rotate at the "crux" of the Y (absolute center), so it basically rotates in place.
My second problem is the speed. Ideally it needs to rotate very fast then slow down and stop. Any thoughts on how to either clean up this code to make it work? I could try it with just transforming the shape, but I'm trying to see if it can be cleaner with Actionscript.
I have a movieclip that I want to use as it is, but I also want a flipped version of it. I looked in methods of movieclip and there doesn't seem to be a flip method.
class Stand { public static const STAND_LIST:Array = new Array(); STAND_LIST[0] = new Array(); STAND_LIST[1] = new Array();
[code]...
is the STAND_LIST[0] keeps created every new instance of Stand created? or is it created just once?if it's created every new instance of Stand created, how do i make it run just once?(like initializing const)
I haven't used as2 in a very long time. I found this code for rotating an object based on the mouse position. How do you actually apply this to the object?
ActionScript Code: onClipEvent (enterFrame) { // find x and y differences disx = _root._xmouse-_x;
Two days ago I managed to create XML based gallery the problem is I want to create a menu OVER the gallery the issue is when I create an object and place it over the gallery it actually displayes it underneath the gallery.
I'm learning to use Object-pooling. I'm trying to see how to get objects from the start of the pool and shift all the objects at position i to i-1. I've had a look at Adobe's help file on the subject [URL] but there I'm confused.