-
1. Re: Applying Different Function to one Button based on which Frame it is
Ned Murphy Nov 8, 2014 7:24 AM (in response to navigator81)You could put a conditional or switch in the event handler function that takes action based on the currentFrame property.
-
2. Re: Applying Different Function to one Button based on which Frame it is
navigator81 Nov 8, 2014 8:06 AM (in response to Ned Murphy)Ned. thats what i am trying to put but for some reasons , its not taking me passed that frame , i have succeeded to stop it on a certain frame by removing the vent Listener but once i am done with the condition , it should reactive the Listener , but thats not happening , i know its a pretty simple thing , but due to my lack of experience with AS3 , its causing me trouble to troubleshoot it all by my self.
Here is my Code:
btn_nxt.addEventListener(MouseEvent.CLICK, simplenext);
////////////////////////////////SIMPLENEXT FUNCTION FOR NEXT BUTTON ///////////////////////////////////////////
function simplenext(event: MouseEvent): void { if (currentFrame == 9) { btn_nxt.removeEventListener(MouseEvent.CLICK, simplenext); trace("Normal Next Button Disabled"); btn_nxt.addEventListener(MouseEvent.CLICK, nextframe9); trace("Frame 9 Next Button Activated"); btn_notice1.addEventListener(MouseEvent.CLICK, loadnotice1); pop1.closebtn.addEventListener(MouseEvent.CLICK, unloadbtn1); } else { nextFrame(); } } /////////////////////////FUNCTION FOR FRAME 9 //////////////////////////////////////
Please note that Count is the Counter variable that i defined to increment once the popup movie clip is loaded
function nextframe9(event: MouseEvent): void
{
if(count == 1 && stage.contains(pop1) )
{
removeChild(pop1);
}
if(count == 1)
{
nextFrame();
}
else
{
addChild(pop1);
pop1.x = 40;
pop1.y = 120;
count = 1;
}
}
-
3. Re: Applying Different Function to one Button based on which Frame it is
Ned Murphy Nov 8, 2014 11:00 AM (in response to navigator81)What I suggested is not what I see you implementing. You are trying to change the function that the button calls and you don't need to do that, but you can if you work out the logic properly. Chances are you are missing following the logic if it is not behaving as you intend. I think you are tangling yourself in the logic by separating things out as you are.
This is where you need to learn how to make the best use of the trace() function. If you expect something to happen based on conditions being met, then you need to check those conditions to see if they are what you think rthey should be.
-
4. Re: Applying Different Function to one Button based on which Frame it is
navigator81 Nov 8, 2014 11:24 AM (in response to Ned Murphy)Thanks Ned for the guidance , can you give me an example a sample to get an idea of how you think I should run this , I am new with action script 3 and you ar eright , I am tangeling my self a lot with this logic for a while now , I need to devliver this presentation by Monday and I am no where near fixing this thing for me.
-
5. Re: Applying Different Function to one Button based on which Frame it is
Ned Murphy Nov 8, 2014 2:43 PM (in response to navigator81)If you find a function is not doing whatyou expect, test the conditions that should have made it process. For instance... check the values to see that they are what you expect them to be....
function nextframe9(event: MouseEvent): void
{
trace("count value (1?): ", count);
trace("pop1 present (true)?: ", stage.contains(pop1));
if(count == 1 && stage.contains(pop1) )


