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
window.parent ne radi u Firefoxu

 
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 -> Client-side
View previous topic :: View next topic  
Author Message
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 07.06.2007 12:39    Post subject: window.parent ne radi u Firefoxu Add user to your forum ignore list Reply with quote

Pozdrav

Imam jedan problem i nije mi jasno zašto ne radi. Problem je sljedeći: imam stranicu i na njoj imam flash animaciju.

Na stranici je i iframe u kojem su linkovi koji bi trebali pozivati js funkciju iz glavnog prozora, no to ne radi u FF, iako IE 7 sve ok radi.

funkciju pozivam preko linka s onmouseover="window.parent.mojafunkcija()", mene zanima zašto ne radi to u FF ?

Probao sam samo s parent.Mojafunkcija() i niti to ne radi, iako IE puši i to.

Može neka pomoć. Hvala

_________________
Odin's descendant
Back to top
View user's profile Send private message
ghosap



Joined: 18 Sep 2003
Posts: 79

PostPosted: 07.06.2007 17:35    Post subject: Add user to your forum ignore list Reply with quote

Pozdrav,
parent.funkcija() bi trebalo radit, mozes probat i top.funkcija()
Mozda kad bi rekao sto bi otprilike trebala radit funkcija ....

_________________
. . . and when the balance is lost all that is left is the reckening . . .
Back to top
View user's profile Send private message
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 10.06.2007 23:31    Post subject: Add user to your forum ignore list Reply with quote

Na parent stranici imam flash animaciju i javascript funkciju koja suži da preko nje, flash animaciji prenosim određene parametre preko linka. Znači da kad se prijeđe mišem preko linka da se nešto događa s animcijom.

Linkovi su u iframeu (posebna stranica) e sad ja trebam iz tog iframea pozvat js funkciju koja se nalazi u parent stranici.

parent.moja_funkcija() ne radi niti u jednom browseru osim u IE-u. Zašto ? i kako to srediti da radi barem u FF.

_________________
Odin's descendant
Back to top
View user's profile Send private message
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 11.06.2007 09:33    Post subject: Add user to your forum ignore list Reply with quote

parent.moja_funkcija() bi trebalo raditi, ako ti je moja_funkcija() dobro scopeana, i pripada window objektu.

problem moze biti u tome sto imas mozda:
moja_funkcija = function() { ... }

ako je tako (ili slicno, tipa da trpas sve u anonimnu funkciju koja se odmah izvrsava) - nece raditi. moglo bi proraditi ako ako napravis:
window.moja_funkcija = function() { ... }

ako nije nijedno od te dvije mogucnosti, onda daj source, ili digni na net negdje simplified testcase, pa ce biti puno lakse shvatiti o cemu pricas...

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 11.06.2007 12:04    Post subject: Add user to your forum ignore list Reply with quote

Ovo je javascripta koja je u glavnom prozoru
Code:

var movieName = "map";
      
      function thisMovie(movieName) {
      // IE and Netscape refer to the movie object differently.
      // This function returns the appropriate syntax depending on the browser.
      if (navigator.appName.indexOf ("Microsoft") !=-1) {
      return window[movieName]
      } else {
      return document[movieName]
      }
      }
      
      // Checks if movie is completely loaded.
      // Returns true if yes, false if no.
      function movieIsLoaded (theMovie) {
      // First make sure the movie's defined.
      if (typeof(theMovie) != "undefined") {
      // If it is, check how much of it is loaded.
      return theMovie.PercentLoaded() == 100;
      } else {
      // If the movie isn't defined, it's not loaded.
      return false;
      }
      }
      
      function showItem(num) {
      if (movieIsLoaded(thisMovie(movieName))) {
      thisMovie(movieName).SetVariable("numTxt", num);
      }
      }
      function hideItem(num) {
      if (movieIsLoaded(thisMovie(movieName))) {
      thisMovie(movieName).SetVariable("numTxt", "");
      }
   }


Ja unutar stranice imam iframe gdje su linkovi preko kojih pokrećem gornju javascriptu. Link izgleda ovako, no u FF se ništa ne događa s animacijom, dok IE normalno poziva funkciju.

<a href="nesto.html" onmouseover="parent.showItem()" onmouseout="parent.hideItem()">Moj link</a>

_________________
Odin's descendant
Back to top
View user's profile Send private message
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 11.06.2007 12:59    Post subject: Add user to your forum ignore list Reply with quote

Probaj maknuti "var" ispred movieName varijable...

Mozda ti movieIsLoaded() funkcija vraca false u non-IE varijanti?

Probaj: alert(typeof(parent.showItem)); u firefoxu, i vidi sto vraca, ili si instaliraj Firebug i stavi breakpoint u showItem() funkciju, pa vidi da li se uopce poziva... Ili samo sa Firebugom opali Profiling skripte, i vidi kako se i kojim redosljedom pozivaju funkcije, i gdje je razlika u onom od ocekivanog.

Kasnije cu si probati sloziti testcase lokalni bas sa iframe-om i nekim simple flashom kojem se predaju varijable...

Mozes probati i alert(parent.movieName);, vjerojatno je undefined ili nesto, zbog onog "var" kad pozivas preko parenta...

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 11.06.2007 14:57    Post subject: Add user to your forum ignore list Reply with quote

Probao sam ovo:
alert(typeof(parent.showItem));

i u FF u alert boxu sam dobio 'function', znači on ga prepoznaje kao funkciju. Skinuo sam firebug i kad prijeđem mišem preko linka firebug kaže da PercentLoaded nije funkcija. Nakon toga sam maknuo () poslije PercentLoaded, no onda ne radi nigdje pa niti u IE-u.

Testirao sam movieIsLoaded() i firefox vidi normalno da je flash učitan ...

_________________
Odin's descendant
Back to top
View user's profile Send private message
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 11.06.2007 17:59    Post subject: Add user to your forum ignore list Reply with quote

zvone wrote:
Skinuo sam firebug i kad prijeđem mišem preko linka firebug kaže da PercentLoaded nije funkcija.

A da li mu je objekt na kojem gleda tu funkciju dobar?

Mozda da u firefoxu probas sa document.getElementById('id_moviea').PercentLoaded()?

Da li ti i embed i object imaju pravilne id-ove? Ili koristis samo name? Koji je doctype?

http://www.kirupa.com/forum/archive/index.php/t-76851.html
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683&sliceId=2

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
ghosap



Joined: 18 Sep 2003
Posts: 79

PostPosted: 11.06.2007 20:17    Post subject: Add user to your forum ignore list Reply with quote

Govorim malo napamet, neznak kako je sa flashom, ali mozda da svaki put referenciras objekte u parent window sa parent.object... jer znam da se zna desit da js trazi te objekte u iframe-u a ne u parent widow ...

_________________
. . . and when the balance is lost all that is left is the reckening . . .
Back to top
View user's profile Send private message
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 13.06.2007 14:37    Post subject: Add user to your forum ignore list Reply with quote

any progress?

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 02.07.2007 13:32    Post subject: Add user to your forum ignore list Reply with quote

Evo nakon toliko dana razbijanja glave i dalje mi ne radi ... Zy, pogledaj PM.

_________________
Odin's descendant
Back to top
View user's profile Send private message
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 02.07.2007 15:42    Post subject: Add user to your forum ignore list Reply with quote

Huh... svasta si ti tamo nakrcao...

Ovako, osnovni problem je taj sto koristis prastari AC_FL_RunContent() od Macromedie, koji je katastrofa.
Ako hoces ostati pri njemu, moras promjeniti njihovu funkciju AC_GetArgs, koja slaze "html" koji ce generirati... Ona po defaultu stavlja i id i name atribute i na object i na embed. To ne valja, i to je jedan od razloga zasto ne radi.

Ovo je modificirana AC_GetArgs funkcija:
Code:

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
     var ret = new Object();
     ret.embedAttrs = new Object();
     ret.params = new Object();
     ret.objAttrs = new Object();
     for (var i=0; i < args.length; i=i+2){
      var currArg = args[i].toLowerCase();

      switch (currArg){
        case "classid":
         break;
        case "pluginspage":
         ret.embedAttrs[args[i]] = args[i+1];
         break;
        case "src":
        case "movie":
         args[i+1] = AC_AddExtension(args[i+1], ext);
         ret.embedAttrs["src"] = args[i+1];
         ret.params[srcParamName] = args[i+1];
         break;
        case "onafterupdate":
        case "onbeforeupdate":
        case "onblur":
        case "oncellchange":
        case "onclick":
        case "ondblClick":
        case "ondrag":
        case "ondragend":
        case "ondragenter":
        case "ondragleave":
        case "ondragover":
        case "ondrop":
        case "onfinish":
        case "onfocus":
        case "onhelp":
        case "onmousedown":
        case "onmouseup":
        case "onmouseover":
        case "onmousemove":
        case "onmouseout":
        case "onkeypress":
        case "onkeydown":
        case "onkeyup":
        case "onload":
        case "onlosecapture":
        case "onpropertychange":
        case "onreadystatechange":
        case "onrowsdelete":
        case "onrowenter":
        case "onrowexit":
        case "onrowsinserted":
        case "onstart":
        case "onscroll":
        case "onbeforeeditfocus":
        case "onactivate":
        case "onbeforedeactivate":
        case "ondeactivate":
        case "type":
        case "codebase":
         ret.objAttrs[args[i]] = args[i+1];
         break;
        case "width":
        case "height":
        case "align":
        case "vspace":
        case "hspace":
        case "class":
        case "title":
        case "accesskey":
        case "tabindex":
         ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
         break;
        case "id":
          ret.objAttrs[args[i]] = args[i+1];
          break;
        case "name":
          ret.embedAttrs[args[i]] = args[i+1];
          break;
        default:
         ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
      }
     }
     ret.objAttrs["classid"] = classid;
     if (mimeType) ret.embedAttrs["type"] = mimeType;
     return ret;
   }


Nakon toga, nacin na koji dohvacas flash objekt na stranici je prastari, skopiran vjerojatno sa moockovog sitea.
Ispod sljedi set funkcija s kojima cijela stvar radi u IE 6 i 7, firefox, te opera 9 (to sam testirao, ostalo mi se neda trenutno)

Code:

        // ovo su funkcije za prikaz flash karte
        movieName = "map";

        function getFlashMovieObject(movieName) {
            if (window.document[movieName]) {
                return window.document[movieName];
            }
            if (navigator.appName.indexOf("Microsoft Internet")==-1) {
                if (document.embeds && document.embeds[movieName]) {
                    return document.embeds[movieName];
                }
            } else {
                // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
                return document.getElementById(movieName);
            }
        }

        // Checks if movie is completely loaded.
        // Returns true if yes, false if no.
        function movieIsLoaded(m) {
            // First make sure the movie's defined.
            if (typeof(m) != "undefined") {
                // If it is, check how much of it is loaded.
                if (m.PercentLoaded()) {
                    return (m.PercentLoaded() == 100);
                }
            } else {
                // If the movie isn't defined, it's not loaded.
                return false;
            }
        }

        function showItem(num) {
            var mov = getFlashMovieObject(movieName);
            if (movieIsLoaded(mov)) {
                mov.SetVariable("numTxt", num);
            }
        }

        function hideItem(num) {
            var mov = getFlashMovieObject(movieName);
            if (movieIsLoaded(mov)) {
                mov.SetVariable("numTxt", "");
            }
        }


Copy paste preko onog sto imas u postojecim fileovima, obrisi visak, i to bi trebalo biti to.

BTW, getFlashMovieObject funkcija je odavde: http://www.permadi.com/tutorial/flashGetObject/

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 02.07.2007 16:41    Post subject: Add user to your forum ignore list Reply with quote

Haha, ovo radi cak i u Safariju na windowsima i na mac-u...

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 02.07.2007 17:01    Post subject: Add user to your forum ignore list Reply with quote

Hvala ti puno, no da bi radila morao sam koristiti SWF object za ubacivanje flasha. Još jednom hvala.

_________________
Odin's descendant
Back to top
View user's profile Send private message
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 -> Client-side 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