PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Bestimten Frame abspielen und zu anderem springen mit einem Knopfdruck?!
Beitrag
<blockquote data-quote="ad86" data-source="post: 1834538"><p><strong>AW: Bestimten Frame abspielen und zu anderem springen mit einem Knopfdruck?!</strong></p><p></p><p>Hi,</p><p></p><p>1. wäre es ja schon mal nicht schlecht zu wissen, ob AS2 oder AS3</p><p></p><p>2. Würde ich das komplett übers Script (und dem Laden einer XML-Datei) machen:</p><p></p><p>Ich geh mal von AS3 und einer Dokumentenklasse aus und jedes Bild ist gleich hoch:</p><p></p><p>[CODE]package {</p><p></p><p> //import Anweisungen</p><p> </p><p> public class ImgSlider extends MovieClip{</p><p></p><p> protected var counter:uint=0;</p><p> protected var actCounter:uint=0;</p><p> protected var actIndex:uint=0;</p><p> protected var lastIndex:uint=0;</p><p> protected var img_mc:MovieClip;</p><p> protected var imgMask_mc:MovieClip;</p><p> protected var white_mc:MovieClip;</p><p> protected var next_mc:MovieClip;</p><p> protected var back_mc:MovieClip;</p><p> protected var sliderTween:Tween;</p><p></p><p> public function ImgSlider(){</p><p> //Laden der XMl-Datei ueber URLLoader, ruft bei Erfolg (Event.COMPLETE) completeHandler auf</p><p> }</p><p></p><p> protected function completeHandler(e:Event):void{</p><p> var xml:XML= new XML (e.target.data);</p><p> var leftPos:Number=0;</p><p> img_mc= new MovieClip();</p><p> for each (var item in xml.image){</p><p> counter++;</p><p> var loader:Loader= new Loader();</p><p> loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeImgHandler);</p><p> loader.x=leftPos;</p><p> leftPos+=Number(item.width);</p><p> img_mc.addChild(loader);</p><p> loader.load(new URLRequest(item.url));</p><p> }</p><p> }</p><p> protected function completeImgHandler(e:Event):void{</p><p> actCounter++;</p><p> if (actCounter>=counter){</p><p> var imgWidth:Number= img_mc.getChildAt(0).width;</p><p> var imgHeight:Number= img_mc.getChildAt(0).height;</p><p> imgMask_mc= new MovieClip();</p><p> imgMask_mc.graphics.beginFill(0xFF000000);</p><p> imgMask_mc.graphics.drawRect(0,0,50,50);</p><p> imgMask_mc.graphics.endFill();</p><p> imgMask_mc.width= imgWidth;</p><p> imgMask_mc.height= imgHeight;</p><p> img_mc.mask=imgMask_mc;</p><p> this.addChild(img_mc);</p><p> this.addChild(imgMask_mc);</p><p> next_mc= new MovieClip();</p><p> next_mc.graphics.beginFill(0xFF0000);</p><p> next_mc.graphics.drawRect(0,0,50,50);</p><p> next_mc.graphics.endFill();</p><p> next_mc.x=imgWidth-50;</p><p> next_mc.y=imgHeight;</p><p> next_mc.addEventListener(MouseEvent.CLICK, nextHandler);</p><p> this.addChild(next_mc);</p><p> back_mc= new MovieClip();</p><p> back_mc.graphics.beginFill(0xFF0000);</p><p> back_mc.graphics.drawRect(0,0,50,50);</p><p> back_mc.graphics.endFill();</p><p> back_mc.x=0;</p><p> back_mc.y=imgHeight;</p><p> back_mc.addEventListener(MouseEvent.CLICK, backHandler);</p><p> this.addChild(back_mc);</p><p> white_mc= new MovieClip();</p><p> white_mc.graphics.beginFill(0xFFFFFF);</p><p> white_mc.graphics.drawRect(0,0,50,50);</p><p> white_mc.graphics.endFill();</p><p> white_mc.visible=false;</p><p> this.addChild(white_mc);</p><p> </p><p> }</p><p> }</p><p></p><p> protected function nextHandler(e:MouseEvent):void{</p><p> if (actIndex<counter-1){</p><p> lastIndex=actIndex;</p><p> actIndex++;</p><p> showImg();</p><p> }</p><p> }</p><p></p><p> protected function backHandler(e:MouseEvent):void{</p><p> if (actIndex>0){</p><p> lastIndex=actIndex;</p><p> actIndex--;</p><p> showImg();</p><p> }</p><p> }</p><p></p><p> protected function showImg():void{</p><p> var maxWidth:Number=Math.max(img_mc.getChildAt(lastIndex).width,img_mc.getChildAt(actIndex).width);</p><p> white_mc.height=img_mc.getChildAt(lastIndex).height;</p><p> white_mc.width=maxWidth;</p><p> white_mc.x=-white_mc.width;</p><p> white_mc.visible=true;</p><p> sliderTween = new Tween(white_mc, "x", None.easeOut, white_mc.x, 0, 1, true);</p><p> sliderTween.addEventListener(TweenEvent.MOTION_FINISH, showNextImg);</p><p> }</p><p></p><p> protected function showNextImg(e:TweenEvent):void{</p><p> if (lastIndex<actIndex){</p><p> img_mc.x=-(img_mc.getChildAt(lastIndex).x+img_mc.getChildAt(lastIndex).width);</p><p> }</p><p> else{</p><p> if (actIndex-1>=0){</p><p> img_mc.x=-(img_mc.getChildAt(actIndex-1).x+img_mc.getChildAt(actIndex-1).width);</p><p> }</p><p> else{</p><p> img_mc.x=0;</p><p> }</p><p> </p><p> }</p><p> imgMask_mc.width=img_mc.getChildAt(actIndex).width;</p><p> var sliderTween:Tween = new Tween(white_mc, "x", None.easeOut, white_mc.x, -white_mc.width, 1, true);</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>Mfg ad86</p></blockquote><p></p>
[QUOTE="ad86, post: 1834538"] [b]AW: Bestimten Frame abspielen und zu anderem springen mit einem Knopfdruck?![/b] Hi, 1. wäre es ja schon mal nicht schlecht zu wissen, ob AS2 oder AS3 2. Würde ich das komplett übers Script (und dem Laden einer XML-Datei) machen: Ich geh mal von AS3 und einer Dokumentenklasse aus und jedes Bild ist gleich hoch: [CODE]package { //import Anweisungen public class ImgSlider extends MovieClip{ protected var counter:uint=0; protected var actCounter:uint=0; protected var actIndex:uint=0; protected var lastIndex:uint=0; protected var img_mc:MovieClip; protected var imgMask_mc:MovieClip; protected var white_mc:MovieClip; protected var next_mc:MovieClip; protected var back_mc:MovieClip; protected var sliderTween:Tween; public function ImgSlider(){ //Laden der XMl-Datei ueber URLLoader, ruft bei Erfolg (Event.COMPLETE) completeHandler auf } protected function completeHandler(e:Event):void{ var xml:XML= new XML (e.target.data); var leftPos:Number=0; img_mc= new MovieClip(); for each (var item in xml.image){ counter++; var loader:Loader= new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeImgHandler); loader.x=leftPos; leftPos+=Number(item.width); img_mc.addChild(loader); loader.load(new URLRequest(item.url)); } } protected function completeImgHandler(e:Event):void{ actCounter++; if (actCounter>=counter){ var imgWidth:Number= img_mc.getChildAt(0).width; var imgHeight:Number= img_mc.getChildAt(0).height; imgMask_mc= new MovieClip(); imgMask_mc.graphics.beginFill(0xFF000000); imgMask_mc.graphics.drawRect(0,0,50,50); imgMask_mc.graphics.endFill(); imgMask_mc.width= imgWidth; imgMask_mc.height= imgHeight; img_mc.mask=imgMask_mc; this.addChild(img_mc); this.addChild(imgMask_mc); next_mc= new MovieClip(); next_mc.graphics.beginFill(0xFF0000); next_mc.graphics.drawRect(0,0,50,50); next_mc.graphics.endFill(); next_mc.x=imgWidth-50; next_mc.y=imgHeight; next_mc.addEventListener(MouseEvent.CLICK, nextHandler); this.addChild(next_mc); back_mc= new MovieClip(); back_mc.graphics.beginFill(0xFF0000); back_mc.graphics.drawRect(0,0,50,50); back_mc.graphics.endFill(); back_mc.x=0; back_mc.y=imgHeight; back_mc.addEventListener(MouseEvent.CLICK, backHandler); this.addChild(back_mc); white_mc= new MovieClip(); white_mc.graphics.beginFill(0xFFFFFF); white_mc.graphics.drawRect(0,0,50,50); white_mc.graphics.endFill(); white_mc.visible=false; this.addChild(white_mc); } } protected function nextHandler(e:MouseEvent):void{ if (actIndex<counter-1){ lastIndex=actIndex; actIndex++; showImg(); } } protected function backHandler(e:MouseEvent):void{ if (actIndex>0){ lastIndex=actIndex; actIndex--; showImg(); } } protected function showImg():void{ var maxWidth:Number=Math.max(img_mc.getChildAt(lastIndex).width,img_mc.getChildAt(actIndex).width); white_mc.height=img_mc.getChildAt(lastIndex).height; white_mc.width=maxWidth; white_mc.x=-white_mc.width; white_mc.visible=true; sliderTween = new Tween(white_mc, "x", None.easeOut, white_mc.x, 0, 1, true); sliderTween.addEventListener(TweenEvent.MOTION_FINISH, showNextImg); } protected function showNextImg(e:TweenEvent):void{ if (lastIndex<actIndex){ img_mc.x=-(img_mc.getChildAt(lastIndex).x+img_mc.getChildAt(lastIndex).width); } else{ if (actIndex-1>=0){ img_mc.x=-(img_mc.getChildAt(actIndex-1).x+img_mc.getChildAt(actIndex-1).width); } else{ img_mc.x=0; } } imgMask_mc.width=img_mc.getChildAt(actIndex).width; var sliderTween:Tween = new Tween(white_mc, "x", None.easeOut, white_mc.x, -white_mc.width, 1, true); } } }[/CODE] Mfg ad86 [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Bestimten Frame abspielen und zu anderem springen mit einem Knopfdruck?!
Oben