Accessing buttons on main stage from inside of a movie clip
Greetings...
here is the scenario:
- I have buttons on main stage, and a swf file which is loaded to scene using a LOADER in AS3
- this is a website, so the problem rises when user moves its cursor around the page and now buttons in main stage,
are still active since they are behind the loaded swf file.
- i would like to learn, how can i CODE inside the loaded SWF file, to either remove the buttons in main page, or remove
the event listeners. not sure if my case has anything to do with .Parent or .roo, (I want to access those main stage
buttons from the SWF file which is loaded)
- The general case is, i have SWF files loading inside another SWF files, is it possible to access items on each stage from
inside of loaded SWF files on that specific stage. Similarly i would be interested to learn about accessing main stage from inside
of movieclips running on stage. how can i access something not in present FLA file yet, in FLA file that is loading the page as SWF.
Thanks.
If you load an swf into another using the Loader class, then the Loader itself is the parent of the loaded swf., so MovieClip(parent.parent) might help you to target the timeline that the Loader was born from. The more proper way to have a loaded file talk to a parent file is thru dispatching events that the parent assigns listeners for after the file has loaded. Here's a link to a posting that might help explain how to implement this.
http://forums.adobe.com/thread/470135?tstart=120
As for the buttons that you want to disable, you could either use the removeEventListener() method to remove the listeners you have assigned, or you could set their mouseEnabled property to false, or you could set their visible property to false.
Similar Messages
-
Referencing a button on main stage from inside a movieclip
I am banging my head against the wall on this.
On the main stage I have a button that I have made invisible once the file is loaded. Inside a movieclip I have on frame 15 the following actionscript 3 code
button_mc.visible = true;
I want the button to become visible at the end of this movieclip. I am not using an external as3 file, I am putting the as3 code in its own layer on the first frame.
I know it has something to do with the path to the button, but I cannot figure it out. If there is anyone who can point me in the right direction for referencing instances by instance name that reside on the main satge from inside a movieclip I would be very grateful.
Thanks
ThepopguyTry:
MovieClip(this.parent).button_mc.visible = true; -
How to access frame lable on main stage from a nested symbol
All-
I have two buttons
btnA on the main stage
btnB is nested inside btnA
How do I access a frame lable on the main stage from btnBok i figured this one out.
i created a button symbol 'BTN-NAV-INTRO' and placed it on the main stage.
i created a mouse over/out effect on it's timeline with an object on top called 'MC-HIT-AREA'
i placed the mouse over graphics inside the button and animated them on their own timelines
coded the MC-HIT-AREA to play those timelines 'MC-HIT-AREA' is nested inside the button
then on the main stage (this is what threw me) i set the button ('BTN-NAV-INTRO') to cursor and coded it to call the other button form the main stage. Nesting it wasn't necessary. I didn't realize you could have multiple mouse over/out effect below a mouse over effect from the main stage
Edge rocks when i get it to do my bidding! -
Access main stage from a symbol timeline?
Can I access main stage from a symbol timeline?
Eg:
I have a symbol called "ball" and its own time line. There is a close button at the end of ball's timeline,
When close button pressed, I want to go back to main timeline.
Thanks
PhyleThanks Hemanth. I will try to explain.
Open Edge animate. On the main stage I added a label called "home".
I created circle, converted to symbol, renamed to "ball".
Inside "ball" , I have a animation, at the end there is a button called "closeBt"
When "closeBt" pressed, I want to go back to main stage "home" -
How do I make all buttons on stage unclickable, while a certain movie clip is visible?
Hi,
I have a button on stage which opens a popup (movie clip is popup + several other buttons). The movie clip and the buttons on it take up most of the stage.
The problem is that the buttons which are on the stage, and are behind the movie clip, remain clickable (you can click through the movie clip!). How may I disable this?
Basically, I need to make it that you cannot click through the movie clip.
Thanks in advance!
PS I am using CS5 and AS2.One way would be to make the movieclip clickable. That would make it block the other objects behind it...
mc.onRelease = function(){ }
mc.useHandCursor = false; // to hide the hand cursor
Another way would be to disable the buttons while the movieclip is present...
btn.enabled = false;
Another way would be to build conditional code into the button clicking code to not work if the movieclip is visible.
btn.onRelease = function(){
if(!mc._visible){
// okay to do stuff -
Arranging object inside of a movie clip
Hi, everybody.
I am new to Flash therefore my apologies for dumb questions up front…
Here we go.
I have four animated buttons with a design element cross_mc inside of another movie clip content_mc. I need all four buttons to be in front of the cross_mc so I get inside of content_mc to arrange the buttons accordingly (Modify > Arrange > Bring toFront). Everything looks hunky dory until I test the movie in which one of the buttons appears to be always behind of the design thingy no matter what I do…(Ahrrr!)
Please feel free to offer an advice, a word of encouragement, or some medical help while I am busy soaping the rope. Thanks.
Cheers.You might be right on the money there. Let's try again... My .fla file consists of 3 layer: static background, actions and one named navigation with four buttons and some design elements defining different site sections. Traditionally navigation menus do not move across the screen and there is indeed a choice of placing them on separate layers. What I meant was that in this case the buttons participate in transitions from one section to the next, hence IMHO can not be separated i.e. are on the same layer.
Here's some screens:
The contents of every section are loaded from a corresponding .swf file once a transition is complete
Thanks. -
Attempt to move main timeline from inside a movie clip breaks menu buttons.
I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.
The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.
My code in the movie clip:
stop()
function replayMovie(event:MouseEvent):void
MovieClip(parent).gotoAndStop(1);
Menu.addEventListener(MouseEvent.CLICK, replayMovie);
My code in frame 1 of the main timeline:
stop();
function bo(event:MouseEvent):void
gotoAndPlay(21)
SoundMixer.stopAll()
espesp.addEventListener(MouseEvent.CLICK, bo);
function ho(event:MouseEvent):void
gotoAndPlay(31)
SoundMixer.stopAll()
espeng.addEventListener(MouseEvent.CLICK, ho);
function yo(event:MouseEvent):void
gotoAndPlay(41)
SoundMixer.stopAll()
engesp.addEventListener(MouseEvent.CLICK, yo);
function go(event:MouseEvent):void
gotoAndPlay(51)
SoundMixer.stopAll()
engeng.addEventListener(MouseEvent.CLICK, go);
The error output when I use my Menu button at the end of the movie clip.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at SSubjunctiveProjNewgrounds_fla::MainTimeline/frame1()
at flash.display::MovieClip/gotoAndStop()
at SSubjunctiveProjNewgrounds_fla::Esp_5/replayMovie()
Any help would be greatly appreciated.For the sake of space, I'll leave out all the package declarations and class declarations and just talk about the functions.
First, the Game class, it has two functions. The first one is the constructor function and it launches at the beginning of the game: First the Game function:
public function Game():void
//Game code goes here
}//Game
We want to listen for someone to click the mouse on the MenuPage, so lets create a new MenuPage and add a listener to the button contiained within it.
public function Game():void
menuPage = new MenuPage;
menuPage.startButton.addEventListener(MouseEvent.CLICK, startGame);
addChild(menuPage);
}//Game
You will notice that before I declared a variable var menuPage:MenuPage, but that's all I did was declare it. I didn't really make a new instance of it, I just set aside space for it. In the first line within the Game function, I'm actually turning that variable into a new instance of a MenuPage.
We don't have a picture of this imaginary menuPage instance, but lets' assume that in our MenuPage MovieClip in the library, we created a SimpleButton called startButton. Here, I'm adding an EventListener that patiently waits for someone to click that button. Once we receive that event, Flash is told to call the startGame function.
As you get better at this, you'll get into custom events, and the eventListener for the button will exist in the MenuPage class file, or even in another class file that you create just for the button. Something like StartButton.as But for now, we can do it as above.
Now the startGame function:
public function startGame(evt:MouseEvent):void
//Remove the start Page
//Add the zombie
//Add the gun
}//startGame
And we'll replace those comments with real code. It follows along with what we just did above.
public function startGame(evt:MouseEvent):void
zombie = new Zombie;
addChild(zombie);
gun = new Gun;
addChild(gun);
And we also want to clean up some by removing the menuPage, and throwing out the eventListener.
public function startGame(evt:MouseEvent):void
zombie = new Zombie;
addChild(zombie);
gun = new Gun;
addChild(gun);
menuPage.startButton.removeEventListener(MouseEvent.Click,startGame);
removeChild(menuPage);
}//startGame
Now our Game class is complete.
The Zombie Class
public function zombieWalk(evt:Event):void
this.addEventListener(Event.ENTER_FRAME,zombieWalk);
this.x = this.x + 10;
}//zombieWalk
Notice we've added a function to the Zombie Class.
The first function adds an EventListener to the zombie. We can use the word this and actionScript knows we're talking about the zombie that the class is written for. This listener fires off every frame. If our FLA file is set to 12fps, then 12 times every second it will call on the zombieWalk function.
The zombie walk function moves the zombie 10 pixels to the right every time the function is called.
On a more advanced level, you'll want to add animation in the MovieClip to move the zombie legs. You'll also want to use Timer events to space out how often the funtion fires and not ENTER_FRAME events. And you'll want to use a static constant to establish how far the zombie moves. We have it now set to 10 pixels, but that can get irritating if we want to change that value later. But again, baby steps.
And finally, the Gun class
public function Gun():void
this.addEventListener(MouseEvent.CLICK, fireGun);
}//function
public function fireGun(evt:MouseEvent):void
this.gotoAndPlay(2);
}//fireGun
First we add an EventListener for when someone clicks on the gun. Once this happens, the listener calls on the fireGun function.
The fireGun function takes advantage of the frames within the Gun MovieClip. Say we have three frames in the Gun MovieClip. The first is just a picture of the gun. The second is the gun with a flash coming out of the nozzle. And the third is the gun at rest again. The line this.gotoAndPlay(2) sends the gun to the second frame with the flash graphic.
For this to work, each frame in the Gun MovieClip has to have some stop and play commands.
But.. you said no code on our timeline!! Liar!
I know. This is the exception. You will need basic stop() commands and gotoAndPlay commands to loop animations. Any MovieClip that has more than one frame will need something to control it.
So our Gun MovieCLip has the following:
Frame 1: stop();
Frame 2: no actionScript... and I mean nothing, not even the words, "no actionScript"
Frame 3: gotoAndStop(1);
This will loop the gun to the beginning and wait for the next time the user clicks the gun.
Advanced features of the Gun class might include a Bullet.as sub-class that creates a bullet MovieClip to fly across the screen. Sound to play when the shooting takes place. Object collision detection to see if the bullet hits the target. And a means by which a custom event will tell the Game.as class that a zombie has been hit and it should be removed from the stage.
As you go down the rabbit hole of ActionScript 3, you will find yourself at a point where it's just a matter of getting the syntax right for all the built in functions and classes. Arrays, Loaders, casting variable types.. all that stuff will come.
I hope this has been helfpul. It's been on my to-do list for a long time. When I first started out, no one could provide me with basic answers for how all these classes and whatnot worked. After teaching myself AS3 for 2 years and reading a gabillion books, I think I've gotten to a point where I'm pretty comfortable with it all. -
How do I recerence Movie Clips on the Main Timeline from inside a class?
Hey everyone, this might be a stupid question but I thought
I'd ask cause it's making me nuts. I'm all of 2 days into AS3
(coming from not using Flash at all in YEARS) so feel free to
consider me ignorant. I do have plenty of application development
experience in other areas though.
I can't seem to create a class that can reference an instance
of a movie clip on my main timeline. I'd post code of what I've
tried but I've gone through so many desperate edits & wild
guesses that it was just garbled junk before I deleted it all.
Basically here's how I figured Flash could work, though maybe
it doesn't work this way at all.
I'm assuming that with AS 3 being so big on being a true
object oriented environment, I wouldn't need to mix my code and
interface together. Preferably I'd be using the Flash authoring
tools just to design my interface. Create a button... place it
somewhere... give it an instance name. Roughly the equivilant of
Apple's InterfaceBuilder for those of you that might be familiar
with Cocoa development. I can see maybe having to put a few lines
of ActionScript onto frame 1 (though really I'm hoping Flash would
have a better method of kicking off the application at this point
that using code tied to frames) to load my classes & such, but
after that I'd like all of my code to be held in external class
files.
So maybe I've got:
Interface.fla - My interface
Button_1
Button_2
TextField_1
Main.as - My main controller class using to handle all of my
applications behavior
SomeClass.as - Some helper Class
SomeOtherClass.as - Some helper Class
Main.as would have instructions in its initialization method
to go ahead & attach events to buttons & initialize
anything else that needs to happen when the application starts.
From there on it would all be objects communicating back &
forth. Button_1 would get clicked with would fire
Main.someMethod(). Main.someMethod() would then do it's thing and
set the value of TextField_1. All very clean & code is very
separated from interface.
Unfortunately I can't for the life of me figure out how AS3
classes reference each other like that. There doesn't seem to be
any kind of a global 'root' or '_root' I can use to locate any
movie clips on the stage. I've searched the help & the web for
any kind of simple tutorial but to no avail. My job has tasked me
with building a flash app for a project but I'd really rather not
have a tone of ActionScript just shoved into frame 1. That just
seems... ugh! (::shudder::)
Can someone maybe point me in the right direction here? I'm
really willing to do my homework but I can't seem to locate the
info I need to get started. Also, is there an ActionScript IRC
channel or something maybe?
Thanks,
CliffI worked with the problem last night and the solution I
started coming to involved creating my own custom document class
based off which extends MovieClip. My thought is that way I have
access to the initialization routine of the timeline itself and
that all of the elements on the main timeline should be
"properties" of my custom class.
Is this correct? Is there a down side to doing this & if
so what is it & why?
Also, just for my reference, the last time I did anything
with ActionScript I think I was using '_root' to target the main
timeline. WHat are the global variable names in AS 3? Is it just
'root' & 'stage' or 'Root' & 'Stage' or what? -
Going Back to the main frame, from inside a movie clip time line.
In flash CS5 I want to go back to the main time line, from inside a movie clip button, so when i click the the movie clip it goes to another frame on the main time line..
Can anyone help me?
Thanks
Daniel Derrickyour can use _root to reference the main timeline from anywhere though that can lead to problems if your swf is loaded by another swf. because of that eventuality, it would be better to use a relative path back to the main timeline.
so, from a movieclip's timeline (when the movieclip is on the main timeline), you can use _parent to reference the main timeline.
but even better would be to use no code on that movieclip's timeline and keep all your code on one timeline (the main one). -
Button on main stage target frame in mc
This seems simple, but for some reason it is not working.
I have a button on the main stage. I want to target my MC
(McSlidey01) that is placed on the main stage.
facts:
McSlidey01 is a MC that is 50 frames long. On the last frame
it has an action script that takes it back to the root and advances
to the nextFrame.
button01 is on the main stage. I want this button to stop
McSlidey01 on frame 25. This way it will stop the MC and not
advance to its last frame that has the nextFrame action on
it.:
-
Problem with access into the main stage
hi, how are you guys ,, i hope you fine
here is my problem
i have file fla called "game.fla" and there are alot of frames in the main stage i wanna move it from
class called "admin" in the library but how??
i tried to this
parent.gotoAndStop(39);
but it doesn.t work i dont know why
and this is the error message
C:\Users\win7\Desktop\game1\admin1.as, Line 902 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObjectContainer.ahh sorry "
I could be more help if I had some code to look at"
here this is all the admin code
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
public class admin1 extends MovieClip
var moves:Boolean;
var points:Number;
var SCREAMING:screaming
var SOUNDCHANNEL:SoundChannel
var vx:Number;
var EATING:eating;
var CHIDORI:chidori
var WIND:wind;
public function admin1(){
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage)
public function onAddedToStage(event:Event):void
stop()
if (currentFrame ==20)
gotoAndStop(1)
WIND = new wind;
SOUNDCHANNEL = WIND.play(0,1000)
CHIDORI = new chidori
EATING = new eating
SCREAMING = new screaming
SOUNDCHANNEL = new SoundChannel
score.restrict = "0-9";
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .5;
fireball1.alpha = .5;
points=0;
hero1.stop();
quizz.stop();
animal1.stop();
evil1.stop();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
fireball1..addEventListener(MouseEvent.CLICK, onfireball1);
burger1.addEventListener(MouseEvent.CLICK, onburger1);
b1.visible = false
b2.visible = false
b3.visible = false
c1.visible = false
c2.visible = false
c3.visible = false
d1.visible = false
d2.visible = false
d3.visible = false
e1.visible = false
e2.visible = false
e3.visible = false
f1.visible = false
f2.visible = false
f3.visible = false
a1.addEventListener(MouseEvent.CLICK, onmouseclicka1);
a2.addEventListener(MouseEvent.CLICK, onmouseclicka2);
a3.addEventListener(MouseEvent.CLICK, onmouseclicka3);
b1.addEventListener(MouseEvent.CLICK, onmouseclickb1);
b2.addEventListener(MouseEvent.CLICK, onmouseclickb2);
b3.addEventListener(MouseEvent.CLICK, onmouseclickb3);
c1.addEventListener(MouseEvent.CLICK, onmouseclickc1);
c2.addEventListener(MouseEvent.CLICK, onmouseclickc2);
c3.addEventListener(MouseEvent.CLICK, onmouseclickc3);
d1.addEventListener(MouseEvent.CLICK, onmouseclickd1);
d2.addEventListener(MouseEvent.CLICK, onmouseclickd2);
d3.addEventListener(MouseEvent.CLICK, onmouseclickd3);
e1.addEventListener(MouseEvent.CLICK, onmouseclicke1);
e2.addEventListener(MouseEvent.CLICK, onmouseclicke2);
e3.addEventListener(MouseEvent.CLICK, onmouseclicke3);
f1.addEventListener(MouseEvent.CLICK, onmouseclickf1);
f2.addEventListener(MouseEvent.CLICK, onmouseclickf2);
f3.addEventListener(MouseEvent.CLICK, onmouseclickf3);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
public function onRemovedFromStage(event:Event):void
//Remove the onEnterFrame event if
//this object is removed from the stage
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
trace("Dungeon removed");
public function onEnterFrame(event:Event):void
if (points == 0 ){
fireball1.alpha = .3;
fireball1.enabled = false;
burger1.alpha = .3;
burger1.enabled = false;
if (points == 1 ){
fireball1.alpha = .3;
fireball1.enabled = false;
burger1.alpha = 1;
burger1.enabled = true;
if (herobar.width == 80){
hero1.gotoAndStop(1);}
if (herobar.width == 60){
hero1.gotoAndStop(2);}
else if (herobar.width == 40){
hero1.gotoAndStop(3);}
else if (herobar.width == 20){
hero1.gotoAndStop(4);}
else if (herobar.width == 0){
hero1.gotoAndStop(5);}
if(evilbar.width == 40)
evil1.gotoAndStop (2)
else if (evilbar.width == 0){
evil1.gotoAndStop(3);}
public function onmouseclicka1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
removeEventListener (MouseEvent.CLICK,onmouseclicka1)
quizz.gotoAndStop(2);
animal1.gotoAndStop(2);
removeChild(a1)
removeChild(a2)
removeChild(a3)
b1.visible = true
b2.visible = true
b3.visible = true
herobar.width -= 20;
play();
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicka2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
removeEventListener (MouseEvent.CLICK,onmouseclicka2)
quizz.gotoAndStop(2);
animal1.gotoAndStop(2);
removeChild(a1)
removeChild(a2)
removeChild(a3)
b1.visible = true
b2.visible = true
b3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicka3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
removeEventListener (MouseEvent.CLICK,onmouseclicka3)
quizz.gotoAndStop(2);
animal1.gotoAndStop(2);
removeChild(a1)
removeChild(a2)
removeChild(a3)
b1.visible = true
b2.visible = true
b3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickb1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.frame.gotoAndStop(3);
animal1.gotoAndStop(3);
removeChild(b1)
removeChild(b2)
removeChild(b3)
c1.visible = true
c2.visible = true
c3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickb2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(3);
animal1.gotoAndStop(3);
removeChild(b1)
removeChild(b2)
removeChild(b3)
c1.visible = true
c2.visible = true
c3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickb3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(3);
animal1.gotoAndStop(3);
removeChild(b1)
removeChild(b2)
removeChild(b3)
c1.visible = true
c2.visible = true
c3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
}public function onmouseclickc1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(4);
animal1.gotoAndStop(4);
removeChild(c1)
removeChild(c2)
removeChild(c3)
d1.visible = true
d2.visible = true
d3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickc2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(4);
animal1.gotoAndStop(4);
removeChild(c1)
removeChild(c2)
removeChild(c3)
d1.visible = true
d2.visible = true
d3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickc3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(4);
animal1.gotoAndStop(4);
removeChild(c1)
removeChild(c2)
removeChild(c3)
d1.visible = true
d2.visible = true
d3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
}public function onmouseclickd1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(5);
animal1.gotoAndStop(5);
removeChild(d1)
removeChild(d2)
removeChild(d3)
e1.visible = true
e2.visible = true
e3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickd2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(5);
animal1.gotoAndStop(5);
removeChild(d1)
removeChild(d2)
removeChild(d3)
e1.visible = true
e2.visible = true
e3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickd3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(5);
animal1.gotoAndStop(5);
removeChild(d1)
removeChild(d2)
removeChild(d3)
e1.visible = true
e2.visible = true
e3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
}public function onmouseclicke1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(6);
animal1.gotoAndStop(6);
removeChild(e1)
removeChild(e2)
removeChild(e3)
f1.visible = true
f2.visible = true
f3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicke2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(6);
animal1.gotoAndStop(6);
removeChild(e1)
removeChild(e2)
removeChild(e3)
f1.visible = true
f2.visible = true
f3.visible = true
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclicke3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(6);
animal1.gotoAndStop(6);
removeChild(e1)
removeChild(e2)
removeChild(e3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickf1 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
else if (points==1){
fireball1.alpha = .3;
fireball1.enabled = false;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(7);
animal1.gotoAndStop(7);
removeChild(f1)
removeChild(f2)
removeChild(f3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickf2 (event:MouseEvent):void
points++
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";}
if (points< 0){
points = 0;
trace(points)
quizz.gotoAndStop(7);
animal1.gotoAndStop(7);
removeChild(f1)
removeChild(f2)
removeChild(f3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onmouseclickf3 (event:MouseEvent):void
points--
if (points == 1 ){
burger1.enabled = true;
burger1.alpha = 1;
if ( points == 2 || points == 3 || points == 4 || points == 5 || points == 6){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
quizz.gotoAndStop(7);
animal1.gotoAndStop(7);
removeChild(f1)
removeChild(f2)
removeChild(f3)
herobar.width -= 20;
SOUNDCHANNEL = CHIDORI.play();
public function onfireball1(event:MouseEvent):void{
if ( points >= 2 ){
points -= 2
evilbar.width -=40
SOUNDCHANNEL = SCREAMING.play();
parent.gotoAndPlay(39)
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0;
public function onburger1(event:MouseEvent):void{
if (points == 1 ){
burger1.alpha = .3;
fireball1.alpha = .3;
burger1.enabled = false;
fireball1.enabled = false;
herobar.width +=20
SOUNDCHANNEL = EATING.play()
points--
if ( points >= 2 ){
burger1.enabled = true;
fireball1.enabled = true;
burger1.alpha = 1;
fireball1.alpha = 1;
herobar.width +=20
points--
SOUNDCHANNEL = EATING.play()
else if (points==0){
burger1.enabled = false;
fireball1.enabled = false;
burger1.alpha = .3;
fireball1.alpha = .3;
if (herobar.width >= 80){
herobar.width = 80}
score.text = String(points);
if (score.text < "0" ){
score.text = "0";
if (points< 0){
points = 0; -
Can't target main stage from dynamically loaded swf...
A part of the Flash app. I'm working on right now does the following -
Main stage loads an external swf using the following function:
function loadAsset(evt:String):void{
var assetName:String = evt;
if (assetName != null){
var assetLdr:Loader = new Loader();
var assetURL:String = assetName;
var assetURLReq:URLRequest = new URLRequest(assetURL);
assetLdr.load(assetURLReq);
assetLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded)
assetLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayAssetLoaderProgress);
function loaded(event:Event):void {
var targetLoader:Loader = Loader(event.target.loader);
assetWindow.addChild(targetLoader);
The externally loaded swf loads another external swf into itself using the following function:
function loadQuiz(evt:String):void{
var quizName:String = evt;
if (quizName != null){
var quizLdr:Loader = new Loader();
var quizURL:String = quizName;
var quizURLReq:URLRequest = new URLRequest(quizURL);
quizLdr.load(quizURLReq);
quizLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded)
quizLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayQuizLoaderProgress);
function loaded(event:Event):void {
var targetLoader:Loader = Loader(event.target.loader);
quizWindow.assetLoader.addChild(targetLoader);
Everything loads fine, but from the quizWindow.assetLoader.addChild(targetLoader) level, I want to send a message/fill in a dynamic text box on the Main Stage. I have been "parenting" my brains out and I'm not sure how to communicate with that level.
can anyone show me the proper path or method based off the above, or have a suggestion?
Cheers,
~ChiplehAndrei1,
Thanks again for your help. I was finally able to get the solution you posted below to work for me.
Much appreciation,
~Chipleh
"In your loaded movie write:
function traceMyself(e:MouseEvent):void{
dispatchEvent(new Event("I_WANT_TEXT"));
function writeText(text:String):void {
xmlFileName1.text = text;
In the top movie that loads external swfs something like that:
loadedSwf.addEventListener("I_WANT_TEXT", onTextRequest, true);
function onTextRequest(e:Event):void {
Object(e.target).writeText(tQuizXmlFile1.theQuizXmlFile.text);
This way these two entities are independent and, most importantly, don't care who is the parent or grandparent." -
Script to control main timeline from inside MC?
This is such a newb question and I'm sorry! I have a Movie
Clip on the main timeline and inside that MovieClip are several
buttons. I want the buttons to go to specific frames in the main
timeline. I have:
on (release) {
gotoAndPlay("PowerPoint");
I know there needs to be something in there to tell it the
main timeline. I searched for this very basic, simple question and
couldn't find anything.
Thanks for any help.if your buttons are true buttons use:
-
Accessing variable in main mxml from component
I have the following problem, i have a main mxml and
component mxml which i import in my main file. I need to access
variable in main mxml file from that component but i don't know how
to reference my main mxml from component? Can someone please help
me with this?
thanks in advanceTry this
this.parentApplication.main_mxml.variableID = 34;
Rgds
JFB
"msabljic" <[email protected]> wrote in
message
news:fd2u5k$a17$[email protected]..
>I have the following problem, i have a main mxml and
component mxml which i
> import in my main file. I need to access variable in
main mxml file from
> that
> component but i don't know how to reference my main mxml
from component?
> Can
> someone please help me with this?
>
> thanks in advance
> -
How to access symbol on main timeline from nested symbol
I did read the the edge JSAPI but still no way to make it work.
Very simple use: you click on a button, a window appears. the button that makes the window appear is supposed to hide some elements which it does. HOWEVER when I want to use a close button within the symbol (window) to make these symbols appear again, it doesnt work.
From inside the symbol I tried:
sym.getComposition().getStage().getSymbol("openTabButtBlack").show();
Doesnt work.sym.getComposition().getStage().$("openTabButtBlack").show();
Maybe you are looking for
-
I have the original iPhone 5 (the one released before 5C & 5S) and when I updated to iOS 8 everything was working well and it was great! Last night I updated to iOS 8.0.2 and it does the complete opposite of what it was supposed to do! I lost my cell
-
Hi I recently installed the Xerox MFP 6110 multifunctional in my network, by plugging it in in the ethernet port of Airport Extreme. Bonjour printing works perfectly, but how can I scan with this machine over the network (not through USB). Pinging be
-
Business One, Terminal Server, and SQL Server on the same machine
Hi, We have a customer who has a machine with Win Server 2003 R2. They are using it as a Terminal Server with Business One for multiple users and as a SQL Server. The have memory leakage issues which they believe are caused by our add-on, which, wh
-
I cannot select certain tools and palettes in InDesign. I have a PC and Windows 7. Is the software not compatible with my operating system? Any fixes?
-
Need help on retrieving query result - NPE
Hi, I could get results with the native query in my TOAD, but I can't get it working in my session EJB. I tried both native query and EJB ql. The query created fine, as soon as I try to retrieve results, it gets stuck. My native query looks like this