freed102 Arayashiki | voici le code :
Code :
- function loadInClip(clip,photo)
- {
- btn_stop._visible=false;
- btn_play._visible=false;
- //removeMovieClip(clip);
- var clip:MovieClip=_root.diapo.attachMovie("MCphoto","MCPhoto",10,{_x:0,_y:0});
- _root.reponse.text="";
- //clip.unloadMovie();
- clip._visible=false;
- if(photo!="./" && photo!="../" )
- {
- parentClip=clip._parent;
- removeMovieClip(parentClip.blinkx);
- removeMovieClip(this._parent.loader);
- blink=parentClip.attachMovie("blink","blinkx",21);
- blink._alpha=0;
- //////trace("blink : "+blink+" depth : "+blink.getDepth() )
- if(_global.lastDiapowidth)
- {
- parentClip.blinkx._width=_global.lastDiapowidth;
- parentClip.blinkx._height=_global.lastDiapoheight;
- parentClip.blinkx._x=_global.lastDiapo_x;
- parentClip.blinkx._y=_global.lastDiapo_y;
- }else
- {
- parentClip.blinkx._width=parentClip.Mask._width+5;
- parentClip.blinkx._height=parentClip.Mask._height+5;
- parentClip.blinkx._x=parentClip.Mask._x-2.5;
- parentClip.blinkx._y=parentClip.Mask._y-2.5;
- }
- _root.reponse.text="photo : ici !!!"+photo
- parentClip.createEmptyMovieClip("loaderClip",22);
- loader=parentClip.loaderClip.attachMovie("loader","loaderx",parentClip.loaderClip.getNextHighestDepth());
- loader._x=(parentClip.Mask._width/2)-(loader._width/2)+parentClip.Mask._x;
- loader._y=(parentClip.Mask._height/2)-(loader._height/2)+parentClip.Mask._y;
- var mcLoader:MovieClipLoader = new MovieClipLoader();
- var mcListener:Object = new Object();
- mcListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number){
- var myTweenLoader:Tween = new Tween(loader, "_alpha", mx.transitions.easing.Regular.easeOut, loader._alpha, 100,0.5, true);
- xpourcent=bytesLoaded*100/bytesTotal;
- thisTextField.htmlText = Math.round(xpourcent)+"%";
- thisTextField.wordWrap = true;
- loader.gotoAndStop(Math.round(xpourcent));
- }
- mcListener.onLoadInit = function(target_mc:MovieClip){
- //d'abord, je rentre la largeur et la hauteur de l'image original dans des variables intermédiaires:
- largeur = clip._width;
- hauteur = clip._height;
- clip._x=0;
- clip._y=0;
- clip._width = largeur*0.555
- clip._height= hauteur*0.555
- //clip.play();
- btn_stop._visible=true;
- btn_play._visible=true;
- btn_stop.onPress=function(){
- //trace(diapo);
- clip.stop();
- }
- btn_play.onPress=function(){
- clip.play();
- }
- //trace("nombre d'images : "+clip._totalframes);
- var time_interval:Number = setInterval(checkBufferTime, 1, clip,clip._totalframes);
- barre.bout_progress.onEnterFrame=function()
- {
- this._x=barre.barre_progression._x+barre.barre_progression._width;
- }
- function tracer(txt)
- {
- reponse.htmlText+=txt+"\n";
- }
- var largeur:Number = barre.barre_progression._width;
- boutons.forward.onPress=function(){
- clip.gotoAndStop(clip._currentframe + 100);
- }
- boutons.goto_end.onPress=function(){
- clip.gotoAndStop(clip._totalframes );
- }
- boutons.goto_begin.onPress=function(){
- clip.gotoAndStop(1);
- }
- btn_play.onPress=function()
- {
- if(_root.currentAction=="pause" )
- {
- _root.currentAction="play";
- boutons.play_pause.gotoAndStop("pause" );
- clip.play();
- tracer("not playing" );
- }
- else
- {
- _root.currentAction="pause";
- boutons.play_pause.gotoAndStop("play" );
- clip.stop()
- tracer("playing" );
- }
- this._visible=false;
- }
- boutons.play_pause.onRollOver=function()
- {
- this.over._alpha=100;
- }
- boutons.play_pause.onRollOut=function()
- {
- this.over._alpha=0;
- }
- boutons.play_pause.onRelease = function() {
- if(_root.currentAction=="pause" )
- {
- btn_play._visible=false;
- _root.currentAction="play";
- this.gotoAndStop("pause" );
- clip.play();
- }
- else
- {
- _root.currentAction="pause";
- this.gotoAndStop("play" );
- clip.stop();
- }
-
- };
- barre.curseur.onPress=function(){
- flux_video.pause();
- clip.stop();
- clearInterval(time_interval);
- startDrag(this,true,barre.timeline._width,0,0,0);
- this.onEnterFrame=function()
- {
- clip.gotoAndStop(Math.floor((barre.curseur._x*clip._totalframes)/barre.timeline._width));
- }
- }
- barre.curseur.onEnterFrame=function()
- {
- this._x=clip._totalframes/barre.timeline._width;
- }
- barre.curseur.onRelease=function(){
- stopDrag();
- clip.gotoAndStop(Math.floor((barre.curseur._x*clip._totalframes)/barre.timeline._width));
- clip.play();
- var time_interval:Number = setInterval(checkBufferTime, 1, clip,clip._totalframes);
- }
- barre.barre_progression.onRelease = function() {
- clip.gotoAndPlay(Math.floor((this._xmouse*clip._totalframes)/barre.timeline._width));
- trace((this._xmouse*clip._totalframes)/barre.timeline._width)
- };
- _global.lastDiapowidth=clip._width;
- _global.lastDiapoheight=clip._height;
- _global.lastDiapo_x=clip._x;
- _global.lastDiapo_y=clip._y;
- blink._width=clip._width;
- blink._height=clip._height;
- blink._x=clip._x;
- blink._y=clip._y;
- blink._alpha=100;
- if(_global.directPlay==1)
- {
- clearInterval(_root['showAll'+id_outil_int]);
- _root['showAll'+id_outil_int]=setInterval(nextDiapo,_global.intervale);
- }
- clip._visible=true;
- var myTweenLoader:Tween = new Tween(loader, "_alpha", mx.transitions.easing.Regular.easeOut, loader._alpha, 0,0.5, true);
- myTweenLoader.onMotionFinished=function(){
- removeMovieClip(loader._parent);
- var myTweenBlink:Tween = new Tween(blink, "_alpha", mx.transitions.easing.Regular.easeOut, blink._alpha, 0,2, true);
- }
- myTweenBlink.onMotionFinished=function(){
- removeMovieClip(blink);
- }
- }
- ////////trace("c'est ici =>"+photo);
- mcLoader.addListener(mcListener);
- //mcLoader.unloadClip(clip);
- mcLoader.loadClip(""+photo+"", clip);
- }
- }
|
|