|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Setting onPress function dynamically?
Hello! I have a problem. I make some movieclips dynamically but i can't make the onPress function to work?
Any ideas whats wrong ... loader_xml.onLoad = function(s){ var antal = loader_xml.firstChild.childNodes.length; for(i=0;i<antal;i++){ photoslider_mc.createEmptyMovieClip("bild"+i,i+100); photoslider_mc["bild" + i]._x = i * 200; photoslider_mc["bild" + i].onPress = function(){ changeImage(loader_xml.firstChild.childNodes[i].attributes.largeimage); } loadMovie(loader_xml.firstChild.childNodes[i].firstChild.nodeValue, "photoslider_mc.bild" + i); } } Last edited by Robban : February 19th, 2004 at 02:46 PM. |
|
#2
|
|||
|
|||
|
Hi, what happens if you put a trace in there?:
photoslider_mc["bild" + i].onPress = function(){ trace(loader_xml.firstChild.childNodes[i].attributes.largeimage); } It could be because "i" doesnt exist inside the object. Try this out: photoslider_mc["bild" + i].onPress = function(){ changeImage(loader_xml.firstChild.childNodes[this.getDepth()-100].attributes.largeimage); } You will know if it's a problem location i if this is undefined: photoslider_mc["bild" + i].onPress = function(){ trace(i); } Does the cursor change to a hand when it's over the moviebutton? |
|
#3
|
|||
|
|||
|
Thank you for helping me but i solved it after a while ...
I solved it like this if you are interested. loader_xml.onLoad = function(s){ var antal = loader_xml.firstChild.childNodes.length; for(i=0;i<antal;i++){ photoslider_mc.createEmptyMovieClip("bild"+i,i+100); photoslider_mc["bild" + i].createEmptyMovieClip("bildh" + i,i+100); photoslider_mc["bild" + i]._x = i * 185; photoslider_mc["bild" + i].large = loader_xml.firstChild.childNodes[i].attributes.largeimage; photoslider_mc["bild" + i].onPress = function(){ changeImage(this.large); } loadMovie(loader_xml.firstChild.childNodes[i].firstChild.nodeValue, "photoslider_mc.bild" + i + ".bildh" + i); } } |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Setting onPress function dynamically? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|