Avatar billede holmqvist Nybegynder
17. august 2005 - 15:38 Der er 6 kommentarer og
1 løsning

just an ordinary function()

But it doesn't work, I've been going nuts over this a while now..

Code:
------------------------------------
depth=0;

for (i=0; i<8; i+=2) {
   
   
   
    _root.attachMovie("singleHouse", "sh"+i, i+1);
    _root.attachMovie("sh1Shade", "sh1Shade"+i, i);
   
   
    height = random(50) +70;
    _root["sh"+i]._yscale = height
    _root["sh1Shade"+i]._yscale = height
   
    depth-=10;
    _root["sh"+i]._y = 360 - depth;
    _root["sh1Shade"+i]._y = 360 - depth;
   
    _root["sh"+i]._x = random(400) +580;
}
// HERE IS THE CALL
_root.sh1Shade0.nr();

------------------------------------------

//AND HERE IS THE FUNCTION
function nr(){
    trace("it works");
}

this.onEnterFrame = function(){
    this._x = _root["sh"+nummer]._x  + ((_root["sh"+nummer]._x / 10) - 30)*-1;
}
--------------------------------------------

I've checked spelling, checked that it actually exists, simplified to a ridiculous level, and it still doesn't work!
Does anyone know why?

/ Jacob
Avatar billede cpufan Juniormester
17. august 2005 - 17:14 #1
you haven't defined nummer
Avatar billede holmqvist Nybegynder
17. august 2005 - 18:21 #2
right.., that's left from before I simplified it... but I don't get any errors so I don't think that is what causes the specific problem that I can't call on the function. But I will try to comment away the enterFrame part later, just in case..

The problem now is I want to call on the function nr() from the _root to the movieclip that it's in, and it simply doesn't, the trace is never done. (nr() is in a movieclip that's been inserted dynamically, as you can see in my code..)
Avatar billede rohaje Nybegynder
17. august 2005 - 22:46 #3
you have to wait one frame before calling the function
//small test- hack
onEnterFrame=function(){
_root.sh1Shade0.nr();
delete onEnterFrame;
}
Avatar billede holmqvist Nybegynder
17. august 2005 - 22:53 #4
Well that sounds like a reasonable explanation, thanks.
I'll try it first thing tomorrow.. (in school)
Avatar billede barklund Nybegynder
18. august 2005 - 09:19 #5
Yet another reason for using components and/or AS2 - because this sort of behaviour simply sucks and makes flash one big hack.

Progress, evolve, take the next step - use ActionScript2!

:D

--
Morten Barklund
Avatar billede holmqvist Nybegynder
12. december 2005 - 14:24 #6
rohaje? you around to collect your points..?
Avatar billede rohaje Nybegynder
12. december 2005 - 15:20 #7
sure, always around for points.. :)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester