ActionScript 3.0 :: Finding An Instance Name From Another Instance Name?

Jan 28, 2010

I have a bunch of text boxes which are acting as labels on a diagram.The idea is all the labels are jumbled up to start with, and the user has to drag the labels to the correct place.So far, I have the labels, and they are dragable, but I want to be able to lock the label onto a specific area (I've called them crashzones) so that when the user drags the label onto the correct area, the label snaps into place.The 'crashzones' instance names, are indentical to the label instance names, with the exception that the 'crashzones' instance names have the letter 'z' at the begining.

On the dragStart event, something (maybe a string) would hold the instance name of the current label and add the letter 'z' to the beggining, so something like ... crashzone = "z" + label1;As there is an instance with the name "zlabel1", when the dragstop event starts, it'll do a 'hittestobject' on the instance "zlabel1".

I'm not entirely sure how to go about this.I've tried creating a string to hold the 'crashzone' name, but the hittestobject event doesnt work with strings i.e: hitTestObject(stringname);I've also tried with Sprite, but as the sprite technically already exists and has a name, I can't give the sprite any properties.

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Objects - XML - Creating A New Instance Of An Object That Uses An Identical Name To An Older Instance Delete The Previous Instance?

Mar 20, 2009

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?

View 1 Replies

Finding Where An Instance Of An Object Is Placed?

Mar 7, 2011

I need to find an instance of a movieclip that is on my flash file. It is really big and uses a lot of memory. It says on the number of times used that there is one instance of the object on the flash file, but I can't find it. I thought I deleted them all but there must be one left. How do I go about finding it? It's a really large flash file with many layers, and I don't want to just delete the library file. Is there any way I can find where the object is placed in my file?

View 2 Replies

ActionScript 3.0 :: Finding Name Of Instance A Movieclip Is In?

May 15, 2011

I have 3 instances of the same movieclip (let's call it mc1). In that movieclip is a different one (mc2). In the class for mc2 i need to find out the instance name of which instance of the mc1 it is in.

Is there a way I can I get the name of the instance of mc1 that mc2 is in?

View 9 Replies

ActionScript 3.0 :: Finding Which Class Instance Was Clicked

Feb 17, 2011

I am importing multiple class instances into my document class. They are buttons that I want to load larger images when clicked. The problem I have is that I don't know how to tell class instance was clicked to load the appropriate larger image.

this is how I am importing the buttons:

ActionScript Code:
package {
public class DocumentClass extends MovieClip {
private var myProj:Content;

[Code]....

I worked with trying to assign myProj.name but I understand in AS3 that isn't the best way to go about this. I also worked with trying to populate an array but I wasn't sure how to get the addEventListener to work when one of the class instances in the array was clicked.

View 1 Replies

ActionScript 3.0 :: Finding The Instance Name Of An Dynamically Added SWF?

Apr 26, 2009

What I have is a navigational button. On click, it adds a MovieClip that contains a SWF.This SWF is a third party news reader/blog. My problem is that when I click on another Navigational button, I can't remove the added SWF (whether I use removeChild() or unload()).The container MC that was added to hold the SWF is removed but the newsreader stays. I assume this is because, that while the newsreader itself works great, it has too many unremoved event handlers, connections.

My main problem is that I can't figure out how to call that added swf by it's name and where on the displaylist it resides. Because I really want to use this newsreader, I've come to accept that I can't remove it. What I'm doing instead is trying to set up a conditional that looks to see if this SWF is already on stage, if so, do nothing but make it visible again(don't re-add the SWF).This is what I have so far, but it's not working (or at least not working without error)

Code:
var blogNewsMC:BlogNewsMC = new BlogNewsMC();
function loadBlog(url:String) {

[code].....

View 3 Replies

Windows :: Finding An Amazon EC2 Hosting Instance For A Website?

May 28, 2011

My company is about to conduct a big project which involves a flash games website. This website is targeted to the US, meaning it will serve a lot of concurrent users. We bought many flash games and the website is about to be finished, so we must find a hosting company right away.

The website consists of 10 static pages, 140KB each (design+images+CSS).JavaScript is being delivered via Google CDN (jQuery, SWFObject) to save bandwidth.We have 20 SWF games, each weights around 500KB to 6MB top.I'm planning to use dynamic compressions and basically any possible method to save bandwidth and resources, but nevertheless I must get a large hosting for possible growing in the future.SQL is nothing special: DB size will be 150MB top and all tables are indexed using fulltext catalogs and non-clustered indexes.

After doing some research, I've found that big websites are using Amazon's EC2. I tried to contact Amazon but they're weren't really helpful. All I got is the following URL.We are talking about Windows 2008 R2 and SQL Server 2008 R2.

View 1 Replies

ActionScript 2.0 :: Finding Instnaces With Instance Names On Them In The Timeline

Jul 3, 2008

I'm working on a site that I received from a co-worker and it�s done with AS2 and the code and instance names are all over the place and it�s really hard for me to follow the code path to change things. I know how to track down what frames and elements have actions through the actions panel but what kind of stumping me is how to find instances with instance names on the stage that are scattered all over the instances that make up the movie. Is there a way to get a log of what instances have instance names attached to them and where they are located in the timeline?

View 1 Replies

ActionScript 2.0 :: Have A Function Draw A Box Around An Object By Finding The Objects Instance Name Via A String?

Jun 5, 2006

Is there a way to have a function draw a box around an object by finding the objects instance name via a string?

such as:

Code:
function BoxObject(object) {
//code to draw a box around the object
}

and then juts have an object with an instance name, like "my_mc" and then call the function on a keyframe like:

BoxObject("my_mc");

View 10 Replies

Actionscript 3 :: Constructor To Assign Instance Name From Super Constant When Adding Instance In Flash IDE?

Jun 17, 2010

I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?

package
{
import flash.display.MovieClip;[code].....

The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.

View 1 Replies

ActionScript 3.0 :: Name Every BounceUp Instance The Same Thing And Then Just Add That One Instance Name To The List The Collision Detector Checks?

Dec 2, 2010

I have a BUNCH of bumpers of four types bounceUp, bounceDown, bounceLeft, bounceRight. during a collision which you hit determines the bounce so they always do the same thing so here's my question.....can i just name every bounceUp instance the same thing and then just add that one instance name to the list the collision detector checks?

i just dont wanna go through and name a hundred each of bounceUp s and bounceDown s individually as the potential for screaming increases proportionally.......

View 5 Replies

Flash :: Play Movie Clip Instance Inside Of Button Instance?

Apr 16, 2011

I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:

function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);

[code].....

View 2 Replies

ActionScript 2.0 :: Possible To Scroll Graphic / Movie Instance As Well As Text Instance In Flash

Jul 19, 2004

Does anyone know if it is possinle to scroll a graphic or a movie instance as well as a text instance in flash. I want to scroll text and images as well. Actually text with imges embedded in it.

View 3 Replies

ActionScript 2.0 :: Use Local Instance Variables Vs Attach New Properties To The Instance Object?

Mar 14, 2006

I am wrapping my brain around OOP in AS2. I am making two posts on two different subjects. My question here is: when should I use local instance variables, and when should I attach new properties to the instance object? (Feel free to correct my terminology.) Let's say I have a class for a scrolling background, which scrolls when I mouse over its edge. I want to put these values somewhere:

1) How wide is the border in which a mouseOver makes it scroll? This is basically a semi-constant I set it up once and keep it the same, unless the user changes it in an options menu to make the border wider or narrower. Call this scrollBorderWidth.

2) How fast is the background scrolling now? I want to track this so I can smoothly change the scroll speed over several frames. This is often changed. Call this scrollSpeed.

It seems I have two ways I can store and access these values and darned if I know which is better practice. METHOD A: Make them local variables in the class, so the scrolling background instance has them as local vars. I set them up thusly:

[Code]....

View 4 Replies

ActionScript 3.0 :: Instance Or No Instance - Call A Function From Another Class?

Jan 26, 2009

I have a general / somewhat newbie question. Is it better practice to call a function from another class like so:

[Code]...

Does one way free up more memory or enhance performance?

View 5 Replies

ActionScript 3.0 :: Create New Instance() When Instance Is A Variable?

Feb 12, 2012

I have a base class I've used on 6 different MC's. Then when I use these MC's my function runs an if statement to check which one to add.

if(id=design) var obj = new design();
if(id=team) var obj = new team();

I want to make it a bit more dynamic and use the id:String to evaluate which new instance to create.

ActionScript Code:
public function loadChapter(id:String):void {
var obj = new instance_of( id )();
}

View 5 Replies

ActionScript 3.0 :: Flex - Construct A Derived Class Instance From An Existing Base Class Instance?

Jan 22, 2010

I have a base class which is being created via remote_object [RemoteClass alias] from the server.I have other specialized classes that are derived from this baseclass, but serialization with the server always happens with the base class.The base class has meta data that defines what the derived class is, for example

[RemoteClass (alias="com.myco...')]
public Class Base
{

[code]....

View 2 Replies

Actionscript 3 :: Communicate Between An Instance Of Flash Embedded In A Browser And A Flash Instance Running In A C# WinForms App?

Dec 23, 2011

I am trying to communicate between an instance of flash embedded in a browser and a flash instance running in a C# WinForms app... I am getting a compile error that say:

1119 Access of possibly undefined property printOut through a reference with static type flash.net:LocalConnection

Here is the actionscript:

var feedback = "";
var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.connect("fromClient")

[code]....

View 2 Replies

Flash :: Unable To Convert An Instance Of A Class To An Instance Of The Class's Subclass?

Sep 15, 2011

I'm using a library that has a function that returns an instance of some class Engine.

I'd like to tack on some interfaces to Engine, so I subclass it class InterfacedEngine extends Engine implements AwesomeInterface. but when I change the code that uses the classes from this:

var engine:Engine = generateEngine();

to this: var interfacedEngine:InterfacedEngine = generateEngine();

It gives me a runtime error (elision mine):

TypeError: Error #1034: Type Coercion failed: cannot convert ...::Engine@1bc2bf11 to ....InterfacedEngine.

What about AS3 classes am I misunderstanding?

View 2 Replies

ActionScript 3.0 :: Access Values Held By A Class Instance From Another Class Instance?

Oct 14, 2009

I have to admit I pretty much ran away from Flash when AS2 came along and only used it for animation purposes over the last 5 years.So I'm having a major crash course in AS3 in Flash CS3 and I'm not enjoying it one bit. I'm getting maybe 10mins of finished work per hour as I try to figure out the limits and rules of AS3. Quite often it seems that AS3 simply can't do what I want it to. Anyway: Characterchecks.as is the main class and it loads a bunch of XML into four arrays. The file starts like this:[code]If I trace the value of, say, cc._Categories from the main FLA, it's empty. I'm guessing that the next line of AS in the main FLA doesn't wait for the previously called function to complete? (This may tie in to my next problem)My next step is that I want to display various things based on the data in the array. I have another class, Display.as which will hold all the functions to create the items on display. I thought it would be best for these to be a separate object. I wonder if I'm right?

So I declare an instance of Characterchecks in the main FLA and call it cc, and then run the functions to populate the arrays... Now I create an instance of Display and call it cd. How can I get functions in cd to see the values of the variables in cc? And if the main timeline can't tell that the functions aren't finished filling the arrays, how is cd supposed to know?I might be asking dumb questions, or maybe I'm doing things ***-backwards, I don't know. I'd appreciate any help, I really would. This whole thing has me at the end of my tether... being the most technically advanced person in my circle of co-workers and web design friends means I have no-one to explain why things need to be done a certain way or what the best way is.

View 3 Replies

ActionScript 3.0 :: Sending A Class Instance Reference To A Different Class Instance?

Apr 14, 2011

I'm creating a little game - The player controls a character that follows the mouse. Pigs run away from the player, and the player has to get them all into a pen. To make the game a little more difficult I'm trying to add an enemy - wolves, that attempt to perform a 'hunt' method every x seconds. This method sends a reference of the wolf instance to Main (my document class) and Main then loops through the pigs on stage to see if there's any nearby. Now as far as I know this works - my problem is I'm unsure how to send the pig instance reference back to the wolf that called the hunt method, so it can then 'target' the pig, and then attempt to pounce on it.

This is my Wolf class:

Code:
package
{
import flash.display.MovieClip;
import flash.events.Event;

[Code].....

View 7 Replies

ActionScript 2.0 :: If (rollover Instance 'imgsmall' ) Then Display Visible Instance - 'imglarge' Then Rollout Then Do Not Display 'imglarge'

Feb 21, 2008

how do you do this...if (you rollover instance 'imgsmall' ) then

display visible instance 'imglarge' then

rollout (instance 'imgsmall') then do not display 'imglarge'

View 2 Replies

ActionScript 2.0 :: Specify An Instance Within An Instance?

Aug 17, 2005

I have a whole bunch of movie clips within a single movie clip. I want to trace exactly which instance-within-instance was selected when the user clicks on the outer movie clip. In other words I need Flash to return the instance name of the Movie Clip I just clicked on.

View 4 Replies

Flash :: "Instance Name At Design Time" Vs "Instance Name Added Dynamically" Vs "Variable Name In Related Class"

Nov 4, 2011

Say i have a movieclip named a_Mc ( ClassA ) I have a sub-movieclip named b_Mc ( ClassB )

CASE 1: Accessing the sub-movieclip b_Mc which is already present inside the a_Mc movieclip

( Since Flash IDE has "Automatic instance naming" OFF )

ClassA mentions the name of b_Mc as => var b_Mc:MovieClip;

NOTE HERE: That the variable name MUST BE same as the name of the instance on stage.

So i can access it as : trace( a_Mc.b_Mc);

[Code]...

View 1 Replies

Flash :: Difference Between MyClass(instance) And (instance As MyClass)

Jul 6, 2010

You can upcast or downcast an instance (to a superclass or subclass) using this syntax:

var i:MyClass = MyClass(instance);

But what does the as keyword do?

var i:MyClass = (instance as MyClass);

View 3 Replies

Actionscript 3 :: Reference A Class Instance From Another Class Instance?

Dec 10, 2010

Quick question. I have been Googling this all morning, but it's either not there, or else written in a way that doesn't register. I am inclined to believe the latter, as this seems like it should be something completely trivial to me. I made a small Flash file using AS 3.0, and this is the first time I've really been able to stick to the OOP way of doing things and not hack together a mix of stuff from the timeline to get around not having everything work in the classes.

So I'd like to keep it that way, but one thing is eluding me: I can't call a method of an instance of another class (than the one I'm calling from) without resorting to "DocumentClass(root).instanceName.method." Intuition tells me there has to be a better way of doing this (like, without having to reference the document class every time I call another class instance's function; and CERTAINLY without having to use the word "root" - that just seems so Flash 5 to me. Does anybody have a better way of doing this that they can share?

[Code]....

View 1 Replies

ActionScript 2.0 :: Instance Name "vidPlayer" The Other With Instance Name "myPlayer"?

Jun 30, 2009

I've got 2 FLVplayback components;

one with the instance name "vidPlayer" the other with instance name "myPlayer"

I want to link them together so that when myPlayer is paused - then vidPlayer pauses too.

Then when myPlayer plays again, vid Player also plays. Also vidPlayer needs to be told to loop the video; but myPlayer doesn't loop I had a crack at it but keep getting errors as I've only been using flash for just over a week. The script i've already done is pretty much irrelevant as its proper crap

View 0 Replies

Access An Instance In A Different FLA?

Sep 28, 2009

I am trying to add a LOAD EXTERNAL MOVIE CLIP behaviour to a button sitting in a .FLA called SERVICESMENU. I want to load a .swf titled MULTIMEDIA.SWF into an instance of an empty symbol called PAGE LOADER on a different .FLA called MAIN.FLA.

The problem is when I am in the SERVICEMENU.FLA file, I cannot see the instances that I created in the MAIN.FLA when following the behaviours wizard so I cannot choose the PAGELOADER instance that was created in and resides in the MAIN.FLA file.

View 2 Replies

ActionScript 3.0 :: Get All The Instance Name?

May 12, 2010

i was create 3 instance using one movieclip.i want to get all the instance name which this code genarate can you help  me. i try to do this in using _pentagen.name but this show only one instance name is this last created instance  name?var _pentagen:pentagen; 

[Code]...

View 4 Replies

ActionScript 3.0 :: Set Value For Instance Name?

Jan 22, 2011

Suppose i have
movie clip1 has instance name of "agent"
movie clip2 has instance name of "road"

if i want to set the value for "road" (set road to 1);

then, the agent will based on 1 to move.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved