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
onMouse eventi na dinamički kreiranom movie clipu

 
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
PaNtHeR



Joined: 17 Sep 2003
Posts: 161

PostPosted: 08.11.2003 16:45    Post subject: onMouse eventi na dinamički kreiranom movie clipu Add user to your forum ignore list Reply with quote

Ajmo flash majstori pomagajte:

Imam movie clip koji kreiram sa createEmptyMovieClip. Unutar njega se nalazi tekstbox također dinamički kreiran, koji se btw. učita iz XMLa. Eh sad, svaki od tih movie clipova trebao bi raditi nesto korisno kada ga se klikne jelte. Postavim mu TrackAsMenu i dodijelim funkciju koja hendla onMouseDown, ali se iz nekog razloga taj mouse event trigerira kada kliknem bilo gdje na sceni.

E sad bi me zanimalo da li netko zna jel se to može uopće ili da probam nešto drugo. A ako netko 'oce reć da se ne može uopće nek ode na www.group94.com pa nek pogleda i kaže mi kako su oni to napravili onda, ak je hrabar. Cool

Pozdrav.

_________________
Back to top
View user's profile Send private message Send e-mail
buzztard



Joined: 08 Sep 2003
Posts: 84

PostPosted: 08.11.2003 18:52    Post subject: Add user to your forum ignore list Reply with quote

Code:

onMouseDown = function(){
    if (this.hitTest(_root._xmouse, _root._ymouse, false){
              .......
   }
}


...ili mu dodaj button unitra koji hendla on(release) ili on(press). jednostavnije rješenje... još mu dodaš i useHandCursor = false i ne vidi se razlika..... :)

_________________
___(-o_o) .o( The tears of stangers are only water. )________
Back to top
View user's profile Send private message Visit poster's website
PaNtHeR



Joined: 17 Sep 2003
Posts: 161

PostPosted: 09.11.2003 21:40    Post subject: Add user to your forum ignore list Reply with quote

hvala na svjetu, ali mislim da mi neće upalit zbog toga što moram kreirat empty movie clip pa tek onda u njega staviti button koji će biti istih dimenzija kao i movie clip, pa bi se moglo dogoditi da se presporo vrti. Zna li netko da li možda postoji neki uobičajeni način za dinamičko kreiranje buttona., bio bih muchos zahvalan.

Pozdrav.

_________________
Back to top
View user's profile Send private message Send e-mail
njava
mi3.crew


Joined: 25 Aug 2003
Posts: 624
Location: Zagreb

PostPosted: 09.11.2003 23:30    Post subject: Add user to your forum ignore list Reply with quote

pa ak vec dinamicki sve kreiras onda ti actually ne treba ni button ni trackAsMenu, mozes ga odsimulirat s movie clipom (sto je zapravo i uobicajena praksa u takvim slucajevima). Kod onMouseOver mu promijenis bg ili kaj ti vec treba da bi postigao zeljeni over efekt a na onRelease ubacis pozive akcijama koje zelis da se dese.
verz d problem?
Back to top
View user's profile Send private message Visit poster's website
PaNtHeR



Joined: 17 Sep 2003
Posts: 161

PostPosted: 10.11.2003 15:32    Post subject: Add user to your forum ignore list Reply with quote

Dakle ako sam te dobro shvatio: kreiram movieclip unutar kojega mi se nalazi textbox. E ja bi htio da movieclip bude klikabilan, ali mi se događa nekakva frka. Postam kod:

Code:

function paste_button_events(button, id) {
   button.trackAsMenu;
   button.useHandCursor = true;
   button.onMouseDown = function() {
      trace(id);
   };
}
function create_text(text_string, format, x, y, cntr, i) {
   switch (cntr) {
   case "main_cntr" :
   case "menu_cntr" :
      button = MCMenu_cntr.createEmptyMovieClip("BT"+i, i+5);
      trace(button);
      button._x = x;
      button.createTextField("txt_menu_item", i+5, 0, 0, 0, 0);
      with (button.txt_menu_item) {
         multiline = false;
         wordWrap = false;
         autoSize = true;
         text = text_string;
         selectable = false;
         paste_button_events(button, i);
      }
      button.txt_menu_item.setTextFormat(format);
   }
}


Sve super, tekstichi mi se kreiraju, ali kada kliknem bilo gdje na sceni u outputu dobijem:
0
1
2
3
4
5
što dolazi od onog tracea u funkciji paste_button_events. create_text je funkcija koja puni menu_container s menu itemima.... bla bla bla Dakle nije mi jasno što radim krivo.

Pozdrav i 'fala.

_________________
Back to top
View user's profile Send private message Send e-mail
Zorin



Joined: 05 Nov 2003
Posts: 19

PostPosted: 10.11.2003 19:56    Post subject: Add user to your forum ignore list Reply with quote

A da umjesto onMouseDown stavis button.onRelease=function() bla bla BLA

vozdra
Back to top
View user's profile Send private message Visit poster's website
njava
mi3.crew


Joined: 25 Aug 2003
Posts: 624
Location: Zagreb

PostPosted: 10.11.2003 20:57    Post subject: Add user to your forum ignore list Reply with quote

aj probaj ovak...

Code:

function create_text(text_string, format, x, y, cntr, i) {
  switch (cntr) {
  case "main_cntr" :
  case "menu_cntr" :
    button = MCMenu_cntr.createEmptyMovieClip("BT"+i, i+5);
    button._x = x;
    button.createTextField("txt_menu_item", i+5, 0, 0, 0, 0);
    with (button.txt_menu_item) {
      multiline = false;
      wordWrap = false;
      autoSize = true;
      text = text_string;
      selectable = false;
    }
    button.onRollOver = function() {
      this.useHandCursor = true;
    }
    button.onRelease = function() {
      trace(this);
      // plus kaj god ti actually treba...
    }
    button.txt_menu_item.setTextFormat(format);
  }
}
create_text('prvi', '', 10, 10, 'menu_cntr', 1);
create_text('drugi', '', 100, 100, 'menu_cntr', 2);
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