Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
my_btn.onRelease = function(){
this.createEmptyMovieClip("mc1",1);
mc1.onEnterFrame = function (){
if (this._currentFrame==79){
this.stop();
delete mc1.onEnterFrame;
}else {this.play();
}
}
}
_root.my_btn.onRelease = function(){
_root.createEmptyMovieClip("mc1",1);
_root.mc1.onEnterFrame = function (){
if (_root._currentFrame==79){
_root.stop();
delete _root.mc1.onEnterFrame;
}else {_root.play();
}
}
}
Original geschrieben von Skyla
ja ist ja klar, dass das script nicht funktioniert, wenn du es auf einen button legst.
wirr ist der code nur, wenn man das problem nicht versteht.
dass problem ist folgendes: du brauchst ja einen controller, der bei jedem onEnterFrame-Event prüft, ob der abspielknopf frame 79 erreicht hat oder nicht. Es gibt kein event, das meldet: hey flash ich bin auf frame 79. Dazu brauchst du folglich einen movieClip, der dieses
onEnterFrame-Event liefert (createEmpty..). Root wird dazu nicht verwendet. Da du ja offensichtlich webdesign in einem professionellen umfeld anbietest, bin ich halt davon ausgegangen, dass du mit den basics vertraut bist. ein umschreiben auf ein button-script sollte deshalb kein problem sein, oder ?
PHP:_root.my_btn.onRelease = function(){ _root.createEmptyMovieClip("mc1",1); _root.mc1.onEnterFrame = function (){ if (_root._currentFrame==79){ _root.stop(); delete _root.mc1.onEnterFrame; }else {_root.play(); } } }
du gibst deinem button die id my_btn und legst das script in frame 1 der maintimeline. hab hier leider kein flash zum testen. sorry wenn ein fehler drin ist.
//des in ersten frame HTM die animation hat den namen "ani2"
_root.ani2.onEnterFrame=function(){
if(_root.count==1){
if (this._currentframe==80){
this.stop();
}
}
else{
this.play();
}
}
//des aufn button!!
on (release){
_root.count=1;
}