Instance question

Posted on 2004-11-23
Last Modified: 2010-04-07
I am using Flash MX ver6.0.

I have four basic symbols:


Dude is controllable with the cursor keys. When dude performs a HitTest, a Trace displays which symbol he touches. (i.e. Square,Circle,Triangle)
(This is purely a test of Flash capabilities)

This is where it gets a little confusing and I may word this wrong.

I can display the "instance name" of the symbol, provided I have supplied one.
However, I want to get the "symbol name" as it appears on the Properties pane next to "Instance of:".

For example, if I make 5 copies of Circle but do not provide an "instance name", I would still like to have all copies of Circle display "Circle" when Dude detects a hit.

Is there a way to do this?
Question by:wendelina
    LVL 16

    Accepted Solution


    From my past experience,

    You can only use the "instance of" name but not outputting it

    LVL 39

    Assisted Solution

    I'll stick my head out on this one ans say, no you cannot access the instance of property.

    Your 2 options, use linkageID - which you have to assign, or use the instance name.

    Why would you want to anyway?
     just curious.


    Author Comment

    This test was really to find an easier way to handle game programming. I also posted on Macromedia's board and found the same answer.

    My goal is to create a working test of a single screen game similar to "Super Mario Bros."

    The tutorials I found suggested ways to make a game in this vein, but I found some of the techniques a little suspect.

    My first goal was to create limitations on the character's movement around the play area. When the player character hit an object, I wanted to find out what type of object the character had come in contact with. This way the player character would react properly to that type of object no matter what the instance.

    This would allow me to drag & drop symbols where I want them to be placed and quickly create limitations on the character's movement. The two most successful tuts I've seen on how to do this use two methods which I find unbelievably inefficient.

    The first was plotting XY coordinates to block out the limitations. Unbeleivably time consuming, but very cool and it makes for some interesting capabilities as far as hit detection.

    The second was creating a hidden layer/symbol/mask or something that lays out the limitations. This just seems messy and time consuming if you plan to have more than a few simple screens. (Bubble Bobble was used as an example, and would probably be relatively easy to build this way.)

    A user on Macromedia's forums suggested the following:

    "You can create classes for you symbols, so that you have a class 'Circle'
    derived from 'Movieclip' (say), then you can test if the type of the object
    you hit with is Circle.

    Another thing you can do is give you instance a property, call it (say)
    'type' eg.

    mycircle.type = "Circle";

    then, when you get your hit test, you can look at the 'type' property of the
    object you hit."

    I think both of these suggestions could make it pretty easy to accomplish my goal.

    My ultimate goal is to be able to create Flash projects where I can treat them like a rapid development environment so I can pump out "sequels" by dragging and dropping symbols and letting the code take care of itself.

    This may just be a dream, but I want to at least test out the possibility.
    LVL 39

    Expert Comment

    i suspect if you use AS 2 and classes, you can determine the superclass.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
    Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now