Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Dynamically Know What Display Object You Hit Test


Hi,

I have a bit of a hit test puzzle.

In my main movie I have 2 movie clips A and B.

Both A and B have movieClips inside them of type "clip"(defined by me).

Also in my main movie I have a bar movieClip that scrolls vertically through my movie.

Im trying to find a way to get the "bar" movie clip to tell me when it hits a movie clip of type "clip" that is inside either A or B.

Any ideas at all?




ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 03-20-2008, 07:29 PM


View Complete Forum Thread with Replies

Sponsored Links:

Test If A Display Object Has Been Added To The Display List
Is there any way to test if a display object has been added to the display list?

View Replies !    View Related
[F8] Flash Object To Display On Top Of An Activex Object
I’m having a problem getting a flash object (menu) to display on top of an activex object. Any ideas?

View Replies !    View Related
Hit Test Object Problem
Hi i have problems with hit test object. If mc moves in straight line it works ok but if it is not in a straight line i get hit detection too soon. Even before two objects collide. Any ideas what is the problem? Or how to get arround it or how to fix it?

I have attached examples of both files.

tnx

View Replies !    View Related
Hit Test Any Object On Stage
If i am preforming a hit test on a object can the hit test be configured to do something if the object hits any other object on stage?

if (MC.hitTestObject(Object)){

do something

}

I've tried using * as well that don't work had search around can't find anything can anyone help?

View Replies !    View Related
Z Sorting.. How To Test What 'level' An Object Is On?
ok, im trying to write a '3d' engine where there are 3 shapes (squares) that are draggable. the less the y value, the smaller they get (perspective..) anyway, is there an actionscript pre made function to test what 'layer' the clips are on? i'm planning on using swapDepths to switch em around.. and it would make my life easier if i could easily tell if the clips are over or under each other.

View Replies !    View Related
Test Whether Function Is Defined In Object?
Is there a way to test whether an object has a function defined?

I have a function that checks whether a requested Loader has finished loading. If it hasn't, it stores the loader in a temporary variable, and adds a listener to the loader.

When the load completes, the listener triggers a second function that places the loader content on the stage and activates a function in the loader content.

Problem is, when the swf is compiled this temporary variable is empty (since the loader hasn't been requested yet), and I get a "1061 Call to possibly undefined method" error from the second function. Which hasn't actually been called yet, just defined.

Can I do something like:
if (exists(loader.content.functionName)) {
// run the function
}

Or some other syntax - is_defined(), != 'undefined', etc. - what's the correct way to check whether a function is defined/exists?

View Replies !    View Related
Trouble Implementing A Hit Test Object
Hi,

OK, Im trying to build an accordian-type menu from scratch.

I have a main class, a menu item class, and on each menu button is a movieclip of a "tab".

Im most of the way there, just trying to get each menu item to stop when it hits a tab of another menu button.

Im trying to use hitTestObject, but getting errors. Essentially Im having trouble talking with the tabs of the individual menu items- i think this is perhaps because i created the menu items from an array in the constructor function and can't access them now...

Im essentially looking for the code that will say "stop moving when you hit any other tab on the stage". Here is the code when I create the menu items and also where Im having trouble.

Thanks for any ideas...


ActionScript Code:
package
{
    import blah blah blah
   
    public class Accordian extends Sprite
    {
       
        public var a:Array = new Array;
        public var menuNum:uint = 5;
        public var tabWidth:int = 22;
        public var tabX:int = 0;
       
        public function Accordian()
        {
            for (var i:uint = 0; i < menuNum; i++)
                {
                a[i] = new MenuItem;
                a[i].x = tabX;
                addChild(a[i]);
                a[i].addEventListener(MouseEvent.MOUSE_DOWN, checkLoc);
                tabX += tabWidth;
                }      
        }   

// trouble code - how do i talk to the menu tabs (a child of MenuItem)?  
       
        private function moveRight(clicked:Event):void
        {
            var movingBtn = clicked.target;
            movingBtn.x += 10;
           
            if ( movingBtn.x >= stage.stageWidth - tabWidth || movingBtn.hitTestObject(MenuItem.tabby))
            {
                movingBtn.removeEventListener(Event.ENTER_FRAME, moveRight);
            }
        }
       
   
}

View Replies !    View Related
Help With A Multi-sided Object And Hit Test.
Hi

I am attempting to make a little flash game and have run into some problems with the hit test.
I have a wall and when the ship hits the wall, the ship bounces back, so for that I used this code

onClipEvent (enterFrame) {
while (this.hitTest(_root.shuttle.hitarea)) {
_root.shuttle._x = _root.shuttle._x+120;

but this only works for one side of the wall, so I have 4 hit areas set up all using the same code as above but with the +120 being -120 and changing to the y value for the top and bottom.

This works ok but it has afew glitches, for instance, the left side of thw wall holds up ok but the right side seems to let the ship pass straight through fairly easily. so heres my questions.

Is there a way that I can just use one code for the entire object instead of 4 hit areas and 4 bits of code ?
failing that can anyone take a look at the fla attached and see why the right side of the wall fails after a few hits ?

even if somebody could point me in the right direction that would be great

Any help would be appreciated ..

Thanks
Sig

View Replies !    View Related
Dynamically Assign & Test Instance Names At Runtime Using Actionscript
I'm creating a script to let the user draw a series of rectangles on the screen, which I need to load into subsequent movie clip instances so that I can track the width/height, etc. and then erase them when they go to another frame and then test to see if they exist and redraw them when they return to the frame.

I've got the following code working, but it creates all the squares in one clip and it works great if you only draw one square. It will let you draw multiple squares, but it puts them all into one mc instance, which screws up the redraw because it sees everything as one square. I also attached the fla file since the code is so long and it is easier to understand if you see it working.


Code:
//if the user moves the cursor within the indicated area, this instantiates the empty clip
if ((_xmouse<790 && _xmouse>150) && (_ymouse<560 && _ymouse>80)) {
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
var mouseListener:Object = new Object();
}
//these are the variables to track the position of the square
var origX:Number;
var origY:Number;
var modX:Number;
var modY:Number;
var modW:Number;
var modH:Number;
/* if the user is within the indicated area, activates drawing,
* sets the initial point variables & creates the instance of the square
*/
mouseListener.onMouseDown = function() {
if ((_xmouse<790 && _xmouse>150) && (_ymouse<560 && _ymouse>80)) {
this.isDrawing = true;
this.orig_x = _xmouse;
this.orig_y = _ymouse;
origX = _xmouse;
origY = _ymouse;
this.target_mc = canvas_mc.createEmptyMovieClip("", canvas_mc.getNextHighestDepth());
}
};
//if the user is within the indicated area, this draws the square
mouseListener.onMouseMove = function() {
if (this.isDrawing) {
if ((_xmouse<790 && _xmouse>150) && (_ymouse<560 && _ymouse>80)) {
this.target_mc.clear();
this.target_mc.lineStyle(2, 0xFF0000, 100);
this.target_mc.moveTo(this.orig_x, this.orig_y);
this.target_mc.lineTo(_xmouse, this.orig_y);
this.target_mc.lineTo(_xmouse, _ymouse);
this.target_mc.lineTo(this.orig_x, _ymouse);
this.target_mc.lineTo(this.orig_x, this.orig_y);
}
}
};
//if the user is within the indicated area, this stops the drawing
mouseListener.onMouseUp = function() {
if ((_xmouse<790 && _xmouse>150) && (_ymouse<560 && _ymouse>80)) {
/*next few lines capture position of the upper left corner of the square
* no matter where the user starts drawing the square
*/
modX = origX;
modY = origY;
modW = canvas_mc._width;
modH = canvas_mc._height;
if (origX>_xmouse && origY<_ymouse) {
modX = origX-canvas_mc._width;
} else if (origX>_xmouse && origY>_ymouse) {
modX = origX-canvas_mc._width;
modY = origY-canvas_mc._height;
} else if (origX<_xmouse && origY>_ymouse) {
modY = origY-canvas_mc._height;
}
//stops drawing
this.isDrawing = false;
Mouse.removeListener(mouseListener);
}
};
Mouse.addListener(mouseListener);
if ((_xmouse>790 && _xmouse<150) && (_ymouse>560 && _ymouse<80)) {
this.isDrawing = false;
Mouse.removeListener(mouseListener);
}
//function to stop drawing and clear the square
clearThreats_mc.onRelease = function() {
removeMovieClip("canvas_mc");
};
//function to redraw the square based on upper left corner and height & width
show_mc.onRelease = function() {
trace(modX+", "+modY+" / "+modW+", "+modH);
this.target_mc = canvas_mc.createEmptyMovieClip("", canvas_mc.getNextHighestDepth());
this.target_mc.lineStyle(2, 0xFF0000, 100);
this.target_mc.moveTo(modX, modY);
this.target_mc.lineTo((modX+modW), modY);
this.target_mc.lineTo((modX+modW), (modY+modH));
this.target_mc.lineTo(modX, (modY+modH));
this.target_mc.lineTo(modX, modY);
canvas_mc._visible = true;
};
Also, I'd like to (ideally) turn this into a class, but I'm not sure how to go about that, what needs to go into the class, what needs to stay in the movie, etc. I've used and modified classes before, but I've never converted a working function/group of scripts into a class.

Thanks!!

View Replies !    View Related
Dynamically Display An Image
Hey Guys,

Been searching and searching and I know this should be simple, but all I can find is loading of external images. For reference, I'm new to actionscript, but a programmer by trade, so catching on very quickly. Anyways, I have a frame in my movie where the user hits the end of the animation, and I need to change the background based on a variable. I have two PNG files in the library:

YOURSCORE_0.png
YOURSCORE_1.png

I need to display one of these two images based on a variable called "q1" equaling 0 or 1. I'll then be using the same actionscript to display other images such as the user's score and checks vs X's over top of it. I'm thinking there's got to be a way to make a symbol that I can swap the bitmap for on the fly, or something like that.

Thanks,
Ben

View Replies !    View Related
Dynamically Display Movieclips - HELP
I am working on a project that I need some help with.

The project is a build-a-chair deal. The different parts of the chair are in the library as movieclips. I want to be able to send the swf the parts of the chair that need to be shown and have it handle that. For instance builder.swf?back=750&seat=4&rarm=R4&larm=L4&color= 336699

I am working on setting up the movieclips so there are 2 layers. One is the color layer and the other is a semi-transparent image with the contours.

My problem is I have no idea how to dynamically get the options from the querystring and display them in flash.

Can anyone offer me any help or maybe point me to a tutorial that would get me started?

Thanks in advance,
Brent

View Replies !    View Related
Dynamically Display Symbol
Hello,

Ive been trying, and trying but it wont work. I have some actionscript, and when a user presses a button, some text appears dynamically on the stage, and I want an image to go along with it. I don't want the button to go to another frame inwhich the image appears, because there are multiple buttons, and multiple images.... to many combinations. So, how can i do this?

Thanks,

Donald

View Replies !    View Related
Display Data Dynamically?
hello friends,
how do i display data dynamically?
I already refered to the tutorial for displaying XML data in flash from Kirupa.com and the amound of data that i want to display varies and i want to display all of them at any given time. Currently what i am doing is adding the set amounts of text areas statically but if the amount of data exceeds that maximum amount, then i wont be able to display the rest?
Need help.
Tx.

View Replies !    View Related
Dynamically Display Jpeg
I want to display a jpeg in a Flash movie based on a value in a MIME-format text file.

The text file is called "variables.txt", and contains the following:

inum=image1.jpg;

The following obviously works:

_root.createEmptyMovieClip("imageHolder1",200);
imageHolder1._x=0;
imageHolder1._y=100;
loadmovie("image1.jpg","ImageHolder1");

But how do I replace the hard-coded image name with the value of the variable?

Is it even possible?

Thanks.

View Replies !    View Related
Display Images Dynamically
I am making slide show of images

I want to upload images from a directory abcd
& file name as during run time
img1
img2
img3

View Replies !    View Related
Create Object Within Object, Dynamically?
Howdy,
I'm creating a firework show. The main timeline creates rocket objects nicely. When it's time for the rocket to explode, creating projectiles in the Rocket object in the same way as the main timeline, it does NOT work dynamically. I can only seem to get it to work in a static way. Here are some examples:

main timeline (works great!):

Code:
this["rocket" + rocketInt] = new Rocket();
this["rocket" + rocketInt].name = "rocket" + rocketInt;
addChild(this["rocket" + rocketInt]);
rocketInt++;
in Rocket (does not work):
Error: ReferenceError: Error #1056: Cannot create property projectile0 on xx.xx.fireworks.Rocket. This error occurs even if all but the first line is commented out.

Code:
this["projectile" + _projectileInt] = new Projectile();
this["projectile" + _projectileInt].name = "projectile" + _projectileInt;
addChild(this["projectile" + _projectileInt]);
_projectileInt++;
in Rocket statically (works, but no fun):

Code:
var projectile0:Sprite = new Projectile();
projectile0.name = "projectile0";
addChild(projectile0);
The last example does exactly what I need it to... but The number of projectiles could be anywhere from 1 to 50. I'd hate to do all that in a non-dynamic way.

Is there any hope?

Thank you much for the assist.

View Replies !    View Related
Building An Object Object Dynamically
I'm trying to build an object object from input text. I can load the information into a variable using LoadVar with no problem but when I load that information into an object ( object {} Flash does not recognize the object as on object.

Any ideas?

Yellow jacket

View Replies !    View Related
Test Wether Functionparameter Is Number, Array, Or Certain Object
Hello

I need a function that tests what type of parameters were passed to it. Something like this:

function test (parameter)
{
if (parameter==typeof(number)) DoSomething;
else if (parameter==typeof(Array)) DoSomethingElse;
else if (parameter==typeof(Object:Test)) DoSomethingDifferent;
else if (parameter==typeof(Object:Two)) DoSomethingcompletlyDifferent;
else DoNothing;
}

View Replies !    View Related
Would Like My SWF To Dynamically Load And Display PHP File Instead Of .txt
I would like the below SWF file to display a blogger-generated PHP file instead of a txt file.

The swf is here: http://home.comcast.net/~llpatte/testing/dom_main.swf

Can I get some help on the coding on this one?

Thanks in advance!

View Replies !    View Related
Dynamically Display Image(s) In Scrollpane
Can anyone post some code that will dynamically display an image (or multiple images) in a scrollpane dynamically placed on the stage?

Using Flash MX2004

View Replies !    View Related
Would Like My SWF To Dynamically Load And Display PHP File Instead Of .txt
I would like the below SWF file to display a blogger-generated PHP file instead of a txt file.

The swf is here: http://home.comcast.net/~llpatte/testing/dom_main.swf

Can I get some help on the coding on this one?

Thanks in advance!

View Replies !    View Related
Dynamically Display Image(s) In Scrollpane
Can anyone post some code that will dynamically display an image (or multiple images) in a scrollpane dynamically placed on the stage?

Using Flash MX2004

View Replies !    View Related
Getting The Display Object
i have canvas and the child of canvas is display object. when i resize the canvas ,the display object doesnt get resize.so how to do??
Tell me how to get that display object also??? help me out.

View Replies !    View Related
About Display Object
Hello all ,I can't find the relationship of display object hierarchy with the structure of flash authoring objects.for example what is the correspondent object of the main time line on flash authoring tool in the display object hierarchy?or what is the correspondent object of the scene that we see on the authoring tool in display object hierarchy?
Sincerely yours Mohsena

View Replies !    View Related
About Display Object
Hello all ,I can't find the relationship of display object hierarchy with the structure of flash authoring objects.for example what is the correspondent object of the main time line on flash authoring tool in the display object hierarchy?or what is the correspondent object of the scene that we see on the authoring tool in display object hierarchy?
Sincerely yours Mohsena

View Replies !    View Related
Dynamically Display Contents Of A Folder Through Actionscript
I am attempting to display the contents of a folder dynamically through actionscript. The files then need to be accessable so thet they can then be clicked to load the content into Flash (JPG images, etc.) Is this possible to do through actionscript alone, or do I need to use Java or similar language and send it to flash? If there is a way I can figure out how to dynamically put the filenames into an array, then I can go from there.

View Replies !    View Related
How To Display The Name Of A Loaded Movie Dynamically In Text Box?
Hello fk.

I have jpegs and swfs that load into a blank movie clip. Is it possible to put a blank dynamic text box on the stage that will display the name of whatever movie of jpeg is loaded into my blank_mc?

For example:

Through loadMovie roses.jpg is loaded into blank_mc.
Text box with instance name textBox displays "roses.jpg" .

Also, to be extra tricky, could you tell it to leave off the .jpg or .swf at the end of the file name when displayed?

View Replies !    View Related
Display Data Dynamically And Make It Clickable
I would like to display data inside a Movieclip called "events"dynamically which come from a multidimensional Array. The Array looks like this:

events[i]["eventtitle"]
events[i]["startdate"]
events[i]["enddate"]
events[i]["city"]

The Movie Clip "events" is 170px wide.
How can the data be displayed so that it looks something like this:

12.08.2005 - 13.8.2005
Meeting 1
Moscow

/* Between the data there is supposed to be enough space so one can differentiate between them. */

19.08.2005 - 20.8.2005
Meeting 2
Berlin

// etc

"Meeting 1" and "Meeting 2", etc are supposed to be clickable,so that the details can be shown in a movie clip called "details".
I
I have no clue how to go about this. Could anybody kindly help me out here?

View Replies !    View Related
[HowTo] Display Navigation Dynamically On A Textfield
greetings...

here is what i want to create but i'm stuck.
I want to create a feedback of text to tell the user in which section he/she is.
Ex. user clicks about button a text in the upper part of the movie will show About... now that's easy... imagine that we have subsection. let's say the user clicks on portfolio then on project one then on image one. I want to display it like this "portfolio >> project one >> image one" . Usually i get these things but now I am stuck... i guess I have to do it in some sort of a function that i will call on the button handler and pass the variable....

Can anyone help me on this one.

Thanks in advance,
dim

View Replies !    View Related
Dynamically Size Stage And Display Area?
I have a slideshow that loads from xml and fades in a variety of sizes of images in random positions. I'm trying to set it up so that the swf (which is in a div tag in an interface) will resize depending on the browser size and will use the NEW stage size to determine the random x/y positions of the images (without resizing them) and will skip any images that are too big for the stage size...

Any ideas if this is possible? Dynamically sizing and determining the "working area" of a swf based on the browser/div size??

THANKS!!!!

View Replies !    View Related
How Do I Dynamically Display Paths In Flash To Get Files From?
Heres what I'm trying to do.

Make a flash site that can be upgradable by the user without my intervention.

Flash will read an XML or TXT file that will tell it how many galleries there are.

Then it will load the thumbnails based on the galleries. The galleries are all located in folders labeled with numbers.

What I can't figure out how to do is tell flash where to look.

For example, flash reads that there are 10 galleries.

the files are loaded out of

1 humbnail.jpg
2 humbnail.jpg
3 humbnail.jpg
4 humbnail.jpg
5 humbnail.jpg

etc

How can I make it look for dynamic paths?

Thanks!

View Replies !    View Related
How To Dynamically Load Mp3's With The Media Display Component.
Alright. So, using the Media Playback component, I am creating an online mp3 player to be used with perl-created databases. Perl part is covered. My problem occurs when I try to reference the mp3 files with a variable. The content the Media Playback component has to be referenced to a variable that is created based on parts of the perl database. Everything I try either yields an Undefined, or it just trys to find the file named "_root.1ID" witch of course is the name of the variable I am trying to extract from.

View Replies !    View Related
How To Dynamically Load Mp3's With The Media Display Component.
Alright. So, using the Media Playback component, I am creating an online mp3 player to be used with perl-created databases. Perl part is covered. My problem occurs when I try to reference the mp3 files with a variable. The content the Media Playback component has to be referenced to a variable that is created based on parts of the perl database. Everything I try either yields an Undefined, or it just trys to find the file named "_root.1ID" witch of course is the name of the variable I am trying to extract from.

View Replies !    View Related
Drawing On Top Of A Display Object
Hi all!

I want to draw lines on top of a display object using the Graphics class.
In the lineTo() documentation it says:

"If the display object in which you are drawing contains content that was created with the Flash drawing tools, calls to the lineTo() method are drawn underneath the content."

I get the same effect when I draw the object with action script.
So my question is, whether is a way to work around this and draw on top of
a display object (a rectangle for example)?

Thanks in advance!
Joost

View Replies !    View Related
Drawing On Top Of Display Object
Hi all!

I want to draw lines on top of a display object using the Graphics class.
In the lineTo() documentation it says:

"If the display object in which you are drawing contains content that was created with the Flash drawing tools, calls to the lineTo() method are drawn underneath the content."

I get the same effect when I draw the object with action script.
So my question is, whether is a way to work around this and draw on top of
a display object (a rectangle for example)?

Thanks in advance!
Joost

View Replies !    View Related
Video Display Object
when executing the following code i get this Error:

Code:
1061: Call to a possibly undefined method attachNetStream through a reference with static type Video.
i am missing some thing obvious.. the class:
thank you for your time.


Code:
package {
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
import flash.display.MovieClip;

public class Video extends MovieClip {

private var nc:NetConnection;
private var ns:NetStream;
private var vid:Video;

public function Video() :void{

nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
vid = new Video();
addChild(vid);
vid.x = 100;
vid.y = 100;
vid.height = 50;
vid.width = 50;
vid.attachNetStream(ns);
ns.play("baby.flv");




}

}

}

View Replies !    View Related
Display Object Problem
Hey Flash community,

I'm coding a new company website and I'm having a few issues that I can't wrap my head around. The main issue is when the index page loads one of the words within the boxes doesn't show up but the other 3 do. But it shows up after you scroll over it. It should load initially. Here is the site address:

http://www.jstokes.com/jsa

Leave feedback and comments. Let me know if there are other issues anyone sees. This is all actionscript3.

View Replies !    View Related
Display Object Issue
Hi All
I have a menu of buttons. when a button is pressed it loads a image. I have created a image container sprite. when the loader loads the image I add the image to that container using addChildAt in theory if I understand correct each new image should replace the previous since there being loaded into the same level but it does not happen. my code is like this.


ActionScript Code:
//outside of button
var container:Sprite=new Sprite  ;

//code in button
var _loader:Loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
            var request:URLRequest=new URLRequest("images/thumb/"+imgUrl);
_loader.load(request);

container.addChildAt(_loader,0);

//also tried
var imgHolder:Sprite=new Sprite  ;
imgHolder.addChild(_loader);
container.addChildAt(imgHolder,0);

all I want is to be able to replace the image with the new one and not keep stacking them. In AS2 I would have just loaded the image into a movieClip or the same level and they would have replaced.

Lost Please help

thanx dave

View Replies !    View Related
Replace Display Object
Hello,

I've been having this problem for awhile and can't figure out an acceptable solution.

I have a MovieClip, I then assign it a display object and then add it to a displaylist. But if I want to change the graphic I can't simply reassign it. In the following code I assign the movieclip a movieclip from the library and add it to the display list, then I try and change the graphic, but the circle stays on screen even though it is now a square.


Code:
var movieClip:MovieClip = new MovieClip()

movieClip = new Circle();

addChild(movieClip);

movieClip = new Square();
One way I've found to get around this is to remove the movieclip from the displaylist, reassign it, then re add it to the displaylist. This works, but then I have to reposition the movieclip again.

Does anyone know of a simple way to swap the graphics?

Thanks

View Replies !    View Related
Display Object Problems ...
Hi - I've done a bunch of searching and googling on this, but I can't figure it out. I want to remove the clip on the the stage when the new one is added. mySprite was the holder. It works the first time, but after that .... I get the

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at MethodInfo-1() error --

and I can't track it down.


Code:

// these are buttons //
CanopyAds.addEventListener(MouseEvent.CLICK, CanopyListener);
GovCircle.addEventListener(MouseEvent.CLICK, GovListener)


function CanopyListener(event:MouseEvent):void {

if(welcomeMC) {
removeChild(welcomeMC) }
if(mySprite) {
removeChild(mySprite); }

var canopyPI = new PortfolioItem();

canopyPI.setText("This is some text.")
addChild(canopyPI);

addChild(mySprite);
mySprite.addChild(canopyPI);


}


function GovListener(event:MouseEvent):void {

if(welcomeMC) {
removeChild(welcomeMC) }

if(mySprite) {
removeChild(mySprite); }

var gcPI = new PortfolioItem();
gcPI.setText("This is some different text")

addChild(mySprite);
mySprite.addChild(gcPI);

}
eventually i'll put this into a function/class so i'm not repeating the code, but right now I'm just trying to get it to work right.

thanks in advance!

View Replies !    View Related
Path Of A Display Object
I'll start with an AS2 analogy. In as2, a trace of an object will display not only its name, but also its absolute path from _root. Is there an equivalence in as3? I have tried describeType, and getQualifiedClassName. It's really helpful to know where you are when adding and removing child.

View Replies !    View Related
Dynamically Display Tumbnails Of All Images Found In A Folder.
I'm trying to find a way to display dynamically all images found in a subfolder called "images", but I've been unable to locate a component or a tutorial. Is this even possible in MX?

Thanks.
Dave

View Replies !    View Related
How To Dynamically Load A List Of Image Files And Display It?
Hi

I'm trying to load a list of images dynamically without entering the information into the xml file. I have seen the example that Flash 8 comes with. I understand an XML file is required. Can the XML file be dynamically updated. Am not really sure how XML works.

any help is much appreciated.

View Replies !    View Related
3D Spiral Menu - Dynamically Display Button Text
I am fairly new to actionscripting and I use Flash MX. I downloaded the sourcecode for the Ultrashock 3D Spiral Menu, but I want to try to dynamically display the button text. For example, if it is the first button, make the text say Home, the second button Profile etc. And how can I add more buttons, what do I need to change in the actionscript. If anyone can help me, I would really appreciate it!

View Replies !    View Related
Sound Object Display Time?
Say I'm loading mp3's dynamically with the sound object. I'd like to be able to show total time of the song, and time elapsed. _totalframes and _currentframe don't seem to work on the sound object, so what should I do?

View Replies !    View Related
Display Tooltip Over A Flashmovie Object
Hi,
I have a flash menu on the left site of the screen which basically are icons only. The movie is very narrow (only 50 pixels wide), so there is not enough room to display text also in there. My problem is that I want a tooltip to appear when doing a mouseover over one of these icons.

I tried using layers, but they seem to dissapear under the flashmovie itself, as well as other flash elements on the webpage.

Since within the flash movie this can't be done, I am looking for a solution whereby a tooltip appears over the flashmovie.

Help very appreciated.

Kind regards
Patrick

View Replies !    View Related
Display Whats In An Unknown Object
Hi

Lets say i have an object returned from a function called retObject.

I dont know what variables are in this object, how can i use actionscript to tell me what variables i can access in that object?

View Replies !    View Related
Designing An Interface For A Display Object
I'm working on a series of classes that each distort an input image using a series of parameters. Each class is a Sprite that contains the distorted version of the input image.

I have the parameters defined in an interface that I plan to implement in each class. How can I include in the interface the fact that each implementation should extend Sprite?

I suppose that I could use a getter that returns a Sprite, but it would be nice if the classes themselves could be added to the display list.

View Replies !    View Related
Accessing Object In The Display List
I'm trying to add a tween event to external images that I load.
The images load just fine and the tween action work.
However the tween only works on the last item loaded.

when i trace my display list it lokk like this
[object MainTimeline] root1
[object MovieClip] level1
[object Loader] temp1
[object Loader] temp2
[object Loader] temp3
[object Loader] tempt1
[object Loader] tempt2
[object Loader] tempt3

As you can see i have named my loader instances.

how do i reference the individual images loaded by the same object loader
the tween ask for object as the first parameter.

any help would be appreciated

thanks

View Replies !    View Related
Display Order OR Target Through Object?
I am encountering a hassle that seems to beg a couple of solution types.

I am working on an inventory system where the user can drag various icons around a grid. One feature is that if the user drops an item on top of another item- the dropped on item would become attached to the mouse pointer. This works- sort of.

My problem is that if the object on the mouse pointer is higher in Z than the object it is over- the ocluded object doesn't recognize the mouse event.

My first glance at controlling Z looks like a major hassle! Everything on my screen has a position in Z, or the display list- whatever. Can I really not say objectName.z = 5; or whatever??? If I could do this I could just drop the Z of the object when it gets picked up and bump it back up when it is dropped. This would allow it to be under the other icons while on the mouse.

OR

Is there a way to let the mouse event penetrate to all layers of Z? Like, be able to click through an object?

Thanks,
T

View Replies !    View Related
Trying To Move Display Object Using 'while' Loop
I'm trying to write a simple title screen sequence that will play at the beginning of a simple game I'm writing.

I have a class called NumberTile2 (a square, basically, with a number in it).

I want to place one of these tiles near the top of the stage and have it slowly descend to the bottom of the stage. (Eventually I'll want several of these appearing and falling to the bottom one after the other but for the moment, to demonstrate the problem I'm having, I'm keeping it to just one tile).

I'm using an event listener which moves the tile down one pixel every frame, and a while loop which keeps running all the time the tile has not yet reached its final resting place.

I'm sure this is not the most elegant way of doing things but I'm interested in finding out why it doesn't work. It's obviously highlighting something fundamental that I'm not understanding about how Flash works.

When I test the movie I get Error 1502: A script has executed for longer than the default timeout period of 15 seconds. Behind that, I get a tile moving down the stage but never stopping and disappearing off the bottom(?!)

If anybody can tell me where I'm going wrong I'd be very grateful.
Thank You for reading this.

Here's my code:

Code:
package
{
import flash.display.*;
import flash.events.*;

public class TitleScreen2 extends MovieClip
{
var nextTile:NumberTile2; // the tile we're currently putting in place
var tilePlaced:Boolean; // flag that tells us when tile has reached the bottom

public function TitleScreen2(container:DisplayObjectContainer) // constructor
{
// create a new tile and place it near the top of the stage
nextTile = new NumberTile2();
nextTile.x = 25;
nextTile.y = 25;
container.addChild(nextTile);

// add event listener which will move tile down each frame
nextTile.addEventListener(Event.ENTER_FRAME, moveDown);
// put tile in place
placeNextTile();

} // end constructor

private function placeNextTile()
{
tilePlaced = false;
while(tilePlaced==false)
{
if(nextTile.y == 150) // if tile is now in place
{
nextTile.removeEventListener(Event.ENTER_FRAME, moveDown); // remove event listener for this tile
tilePlaced = true; // set flag equal to true
}
} // end while
} // end placeNextTile

private function moveDown(e:Event)
{
// move tile down 1 pixel
nextTile.y += 1;
} // end moveDown

} // end class
} // end package

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved