473,394 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Magic persistent Flash Button

karlectomy
My button won't leave the stage.

I'm programming in AS2.0 using Flash MX2004

I attach the button "again" to the stage and its release function is gameOn where I remove the movie clip.

For some reason, It won't leave the stage...

I've tried to look at everything but maybe I'm missing something.
any help would be greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. function gameOn()
  2. {
  3.         again.removeMovieClip();
  4. }
  5.  
  6. function gameOver()
  7. {
  8.         attachMovie("again", "again", 201);
  9.     again._xscale = 120;
  10.     again._yscale = 60;
  11.     again._x = 280;
  12.     again._y = 300;
  13.     again.onRelease = gameOn;
  14. }
Sep 19 '07 #1
7 1810
xNephilimx
213 Expert 100+
Hi karlectomy!
That is no wroking because that's not the correct sintax to the removeMovieClip method.

The correct sintax is the following:
Expand|Select|Wrap|Line Numbers
  1. someMC.removeMovieClip(targetMC);
  2.  
What this does is removing the targetMC that's inside someMC.
If your movieclip "again" is on the root I reccomend to to declare a global variable (that is, outside any function) calld home for example, and making it equal to this (I mean, the "this" pseudo-object), so the variable home, will always be the local root, even inside functions.
Then you can use this as follows:

Expand|Select|Wrap|Line Numbers
  1. var home:MovieClip = this;
  2.  
  3. function gameOn():Void {
  4.     home.removeMovieClip(again);
  5. }
  6.  
Best regards,
The_Nephilim

My button won't leave the stage.

I'm programming in AS2.0 using Flash MX2004

I attach the button "again" to the stage and its release function is gameOn where I remove the movie clip.

For some reason, It won't leave the stage...

I've tried to look at e
verything but maybe I'm missing something.
any help would be greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. function gameOn()
  2. {
  3.         again.removeMovieClip();
  4. }
  5.  
  6. function gameOver()
  7. {
  8.         attachMovie("again", "again", 201);
  9.     again._xscale = 120;
  10.     again._yscale = 60;
  11.     again._x = 280;
  12.     again._y = 300;
  13.     again.onRelease = gameOn;
  14. }
Sep 20 '07 #2
Thank you very much,

I see what you're saying.

can I attach and remove movie clips from the stage?
Sep 21 '07 #3
xNephilimx
213 Expert 100+
You're welcome!

What do you mean? Dynamically attaching a movieclip to the stage?

Thank you very much,

I see what you're saying.

can I attach and remove movie clips from the stage?
Sep 21 '07 #4
More specifically is this correct?

Expand|Select|Wrap|Line Numbers
  1.  
  2. stage.attachMovie("again","again",201);
  3.  
  4. again.onRelease = stage.removeMovieClip(again);
  5.  
  6.  
Sep 22 '07 #5
xNephilimx
213 Expert 100+
The sintax is correct, but you can't use Stage to do that, the Stage object only contains information about the movie, it is not a reference to the _root.

If you want to attach it to the root you can do as follows:
Expand|Select|Wrap|Line Numbers
  1. var home:MovieClip = this;
  2.  
  3. home.attachMovie("again","again",201);
  4.  
  5. again.onRelease = stage.removeMovieClip(again);
  6.  
  7.  
Best regards,
The_Nephilim

More specifically is this correct?

Expand|Select|Wrap|Line Numbers
  1.  
  2. stage.attachMovie("again","again",201);
  3.  
  4. again.onRelease = stage.removeMovieClip(again);
  5.  
  6.  
Sep 24 '07 #6
Neph,

Thanks for your help. finally it's gone!! YAYAYAYA

The sintax is correct, but you can't use Stage to do that, the Stage object only contains information about the movie, it is not a reference to the _root.

If you want to attach it to the root you can do as follows:
Expand|Select|Wrap|Line Numbers
  1. var home:MovieClip = this;
  2.  
  3. home.attachMovie("again","again",201);
  4.  
  5. again.onRelease = stage.removeMovieClip(again);
  6.  
  7.  
Best regards,
The_Nephilim
Sep 24 '07 #7
xNephilimx
213 Expert 100+
LOL!
Glad it worked!! You're welcome!

Best regards!
The_Nephilim

Neph,

Thanks for your help. finally it's gone!! YAYAYAYA
Sep 24 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
6
by: trint | last post by:
Ok, I have created a flash animated button that I want to use as a regular button in my c# web app. Using actionscript, do you know how to call the c# functions in the project? Thanks for any...
5
by: -Lost | last post by:
See, in ActionScript (Flash) I was able to do it this way: frame 1 { this.onEnterFrame = function () { if (buttonIsDown) { i += 1; duplicateMovieClip(_root.layer.target, 'variable_name' + i,...
5
by: mutlyp | last post by:
I have an web application, for a menu to go to page to page wit in the web app I am using flash buttons. The problem is that the first time I click on the flash button everything works fine the page...
6
elamberdor
by: elamberdor | last post by:
Hi All! Trying to get a drop down hide/show div on a html page triggered by a button in flash. (Intro: Very very Little experience in dynamic flash) setup: html page, flash map on page, button...
9
by: anuparvathy | last post by:
i am using a flash template for my website.i am working on asp.net 2.0 for creating my website. this flash template has got buttons.on the click of the button i want the user to be redirected to the...
9
by: mel | last post by:
Hi all, I need a persistent TCP connection with my web server over page reloads. This means that, even if the user goes to a different page (in my domain), I want to keep a TCP connection...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.