Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
addEventListener

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Flash
View previous topic :: View next topic  
Author Message
Vj3k0



Joined: 12 Jul 2007
Posts: 185
Location: Zagreb

PostPosted: 10.08.2007 19:14    Post subject: addEventListener Add user to your forum ignore list Reply with quote

Imam problem. Naime ne znam kako bih promjenio varijablu kad pozovem neku funkciju sa MouseEvent. Konkretno, kada se klikne na djecak_btn treba biti x1=1. Ovako to ne radi jer se nakon izvršavanja funkcije gubi varijabla, a pak funkcija koju zovem ne smije imati argumente da ih prenosim.

Code:
package
{
   import flash.display.MovieClip;
   import flash.display.SimpleButton;
   import flash.events.MouseEvent;
   
   public class GameClass extends MovieClip
   {
      private var x1:Number = 0;
      
      public function GameClass():void
      {
         djecak_btn.addEventListener(MouseEvent.CLICK, djecakFunc);
         djevojcica_btn.addEventListener(MouseEvent.CLICK, djevojcicaFunc);
      }
      
      private function djecakFunc(event:MouseEvent):void
      {
         djecak_btn.enabled = false; x1 = 1;
      }
      
      private function djevojcicaFunc(event:MouseEvent):void
      {
         djevojcica_btn.enabled = false; x1 = 2;
      }
   }
}


Prilično mi je hitno, pa bih bio jako zahvalan ako netko zna rješenje.

Znači ja želim postići da ako se klikne na gumb djecak:btn onda se na varijablu x1 postavi x1=1, a ako na gumb djevojcica_btn onda x1=2.
Back to top
View user's profile Send private message Visit poster's website
Vj3k0



Joined: 12 Jul 2007
Posts: 185
Location: Zagreb

PostPosted: 11.08.2007 09:02    Post subject: Add user to your forum ignore list Reply with quote

Riješio sam si problem s novim as fileom u kojem koristim get i set metode i tamo mijenjam varijable.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Flash All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group