Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
The Flies Component Won't Go Away!; I have flies where I don't need them...
Topic Started: May 18 2005, 09:24 AM (173 Views)
Ramiel
Brackenwood Newbie
I'm using the Flies component (seen in Prowlies) in my latest animation, and it looks great where it is. Problem is, when the component is no longer in any frames and the movie goes on, the flies are still in the exported movie in the later parts, immobile. How do I fix this? (Using Flash MX, not 2004)
Offline Profile Quote Post Goto Top
 
Ramiel
Brackenwood Newbie
Anybody?
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
eeerrrrrrrrrrrrrrr....................... cover them up with something? Or maybe you can bump the alpha down to zero or set its _visible property to false. Sorry I can't offer you any real advice... I'm afraid I've never used Sham's component before.
Offline Profile Quote Post Goto Top
 
Ramiel
Brackenwood Newbie
Nope, nothing. Nothing seems to be working. I can't cover them up because they appear in a spot where I need to have stuff. Is there anybody that can fix this???
Offline Profile Quote Post Goto Top
 
KWarp
Member Avatar
Brackenwood Middleweight
Here's the problem. Anything you set up in Flash will have it's own place on the Z-axis, which determines which objects on the screen go in front of each other. However, when flash runs actionscript and objects are created at run time, they get their place on a seperate z-axis which is ALWAYS in on top of the normal one. Thus you can never cover up the effect and actually have to stop it.

I have no solution. <(-_-)>
Offline Profile Quote Post Goto Top
 
Ramiel
Brackenwood Newbie
KWarp
May 25 2005, 04:51 PM
Here's the problem. Anything you set up in Flash will have it's own place on the Z-axis, which determines which objects on the screen go in front of each other. However, when flash runs actionscript and objects are created at run time, they get their place on a seperate z-axis which is ALWAYS in on top of the normal one. Thus you can never cover up the effect and actually have to stop it.

I have no solution. <(-_-)>

Well, okay. That tells me what was happening, but is there anybody out there who has a solution? :++: :bing:
Offline Profile Quote Post Goto Top
 
chluaid
Member Avatar
Bitey's Daddy
Admin
Make sure you're using them in Flash MX 2004, also that you're exporting as Flash7 AS 2.0, and that you've got the latest Flash Player. Sham wrote code in there which removes the flies from the stage at the end of the scene, so it should do it automatically. If not, just go into the flies component and in the actions, make sure that the last line says:
Code:
 
this._visible = false;


The most important thing is to be sure you're using Flash MX 2004 and exporting as AS 2.0 (unless there's someone out there who can convert the code to AS 1)
Offline Profile Quote Post Goto Top
 
Ramiel
Brackenwood Newbie
Well, I'm using MX, I don't have MX 2004. IS there any way to get it to work in MX? If not, than is there a way to modify the code for MX? And if all else fails, I'm scrapping them completely. Thanks for the help though. Any more?
Offline Profile Quote Post Goto Top
 
chluaid
Member Avatar
Bitey's Daddy
Admin
There's your problem then.. the code is AS 2, so I suggest heading over to the Actionscript forum and asking for help there. I'll move this thread there now and maybe someone can convert it for you. Don't worry... I'm sure someone will get it working for MX :)

If all else fails, when you've finished your movie you could download the trial version of MX 2004, export the movie with Actionscript 2.0. That'd do it.
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Hey mate!

If you post the code here, I'd be more than happy to translate it for you ^_^
Offline Profile Quote Post Goto Top
 
Squidclops
Member Avatar
Guy with a hat.
Maybe try giving the component an instance name then try removing it with unloadMovie() or something. That will work if the flies are children of the component. Or it should anyway.
Offline Profile Quote Post Goto Top
 
Ramiel
Brackenwood Newbie
Vector
May 26 2005, 06:41 PM
If you post the code here, I'd be more than happy to translate it for you ^_^

Okay, here's the script that's in the component...

function flyInit() {
this.speedX = Math.random()*speed;
this.speedY = Math.random()*speed;
this.onEnterFrame = flyMove;
}
function flyMove() {
this._x += this.speedX;
this._y += this.speedY;
if (Math.abs(this._x-sX)>sWidth) {
this.speedX = -this.speedX;
this._x = this._x+this.speedX;
}
if (Math.abs(this._y-sY)>sHeight) {
this.speedY = -this.speedY;
this._y = this._y+this.speedY;
}
if (Math.random()<jitter) {
this.speedX = Math.random()*speed-speed/2;
this.speedY = Math.random()*speed-speed/2;
}
}
function flyDie() {
for (var i = 0; i<numFlies; i++) {
var fly:MovieClip = _parent["fly"+i];
fly.removeMovieClip();
}
}
var sWidth = this._width/2;
var sHeight = this._height/2;
var sX = this._x;
var sY = this._y;
for (var i = 0; i<numFlies; i++) {
var fly = _parent.attachMovie("fly", "fly"+i, i);
fly._x = sX+(Math.random()*sWidth*2)-sWidth;
fly._y = sY+(Math.random()*sHeight*2)-sHeight;
fly.onEnterFrame = flyInit;
}
this._visible = false;
this.onUnload = flyDie;

A conversion would be great! Thanks!
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
I think the only thing in there that is incompatible with AS 1.0 is the line that reads:
Quote:
 
var fly:MovieClip = _parent["fly"+i];

try taking out the ":MovieClip"
Quote:
 
var fly = _parent["fly"+i];

I never did much coding when I had flash MX, so I'm not to sure weather or not there's anything else in there that would cause problems.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply