IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ActionScript 1 & ActionScript 2 Discussion :

Comment désactiver la fonction de lecture automatique ?


Sujet :

ActionScript 1 & ActionScript 2

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mai 2012
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2012
    Messages : 16
    Par défaut Comment désactiver la fonction de lecture automatique ?
    Bonjour,

    Je cherche dans le code la fonction qui permet de désactiver la lecture auto des fichiers mp3 d'un lecteur si vous pouviez m'indiquer la ligne en question voir le code je galère pas possible merci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
     
     
    // Create Sound Object
    var mp3_player:Sound = new Sound(this);
    // Set Starting Volume
    var player_volume:Number = 75;
    // Shuffle playlist mode on /off
    var shuffle = false;
    // Create Playlist Array
    var play_list:Array = [];
    // Song position
    var current_position:Number = 0;
    // Starting Playing Song Number
    var current_song_number:Number = 0;
    // Starting Show Playlist on / off
    var play_list_open:Boolean = false;
    // Now playing or Stop Boolean Value
    var playing_status:Boolean = false;
    var drag_start:Boolean = false;
    var move_stop:Boolean = false;
    // Create mask for play list
    play_list_mc.setMask(mask_mc);
    play_list_mc._y = play_list_mc._y-play_list_mc._height;
    // Player Mute on / off
    var mute:Boolean = false;
    // if shuffle mode on, goto shuffle button "on"
    var goto_shuffle:String = shuffle ? "shuffle_on" : "shuffle_off";
    shuffle_mc.gotoAndStop(goto_shuffle);
    // Create playlist XML
    var play_list_xml:XML = new XML();
    play_list_xml.ignoreWhite = true;
    play_list_xml.onLoad = function(load_status:Boolean):Void  {
    var nodes:Array = this.firstChild.childNodes;
    play_list_length = nodes.length;
    for (var i = 0; i<nodes.length; i++) {
      // add all song information to playlist array
      play_list.push({url:nodes[i].attributes.url, artist:nodes[i].attributes.artist, track:nodes[i].attributes.track});
    }
    // goto duplicate songname on playlist function
    create_play_list();
    if (shuffle) {
      // if shuffle mode on, goto select random song number function
      shuffle_playlist(current_song_number);
    } else {
      // if shuffle mode off, goto and play ordinary song
      play_song(current_song_number);
    }
    };
    // load xml file
    play_list_xml.load("xml/songs.xml");
    // Define duplicate song information's text field in playlist function
    create_play_list = function () {
    var song_name = this.play_list_mc.scroller_mc.mc.song_name_mc.text_mc;
    // add first text field song name info
    song_name.name_txt.text = play_list[0].track+" - "+play_list[0].artist;
    // first song number
    song_name.number_txt.text = "01.";
    // define song id
    this.play_list_mc.scroller_mc.mc.song_name_mc.color_bar_mc.id = 0;
     
    for (i=2; i<play_list_length+1; i++) {
      //  duplicate song name text field
      var song_name = this.play_list_mc.scroller_mc.mc.song_name_mc.duplicateMovieClip("song_name"+i, i);
      // Define song number id
      song_name.color_bar_mc.id = i-1;
      // song name y position
      song_name._y = this.play_list_mc.scroller_mc.mc.song_name_mc._y+this.play_list_mc.scroller_mc.mc.song_name_mc._height*(i-1);
      // add song information to dynamic text field
      song_name.text_mc.name_txt.text = play_list[i-1].track+" - "+play_list[i-1].artist;
      // add song number
      if (i<10) {
       song_name.text_mc.number_txt.text = "0"+String(i)+".";
      } else {
       song_name.text_mc.number_txt.text = String(i)+".";
      }
    }
    // open and show playlist
    if (play_list_open) {
      var distance_y = 155;
      show_playlist_mc.gotoAndStop("close");
      // playlist move down or up function
      content_move(play_list_mc, distance_y, 0.3);
    }
    };
    // Define Play Song Function. This function is for load and play specific song number
    play_song = function (song_number) {
    // stop old song
    mp3_player.stop();
    // set to start position
    mp3_player.start(0, 1);
    // start load song via streaming
    mp3_player.loadSound(play_list[song_number].url, true);
    // set song volume
    set_volume(player_volume);
    // goto play / pause button to pause mode
    play_pause_mc.gotoAndStop("pause");
    // set status to now playing
    playing_status = true;
    // show song name info text
    display_song_name_mc.title_txt.text = play_list[song_number].track+" - "+play_list[song_number].artist;
    // create time loop for display time
    timer = setInterval(display_time, 1000);
    };
    // if play/pause button over, call this function
    play_pause_mc.onRollOver = function() {
    if (playing_status) {
      play_pause_mc.gotoAndStop("pause_over");
    } else {
      play_pause_mc.gotoAndStop("play_over");
    }
    };
    // if play/pause button Rollover, call this function
    play_pause_mc.onRollOut = function() {
    if (playing_status) {
      play_pause_mc.gotoAndStop("pause");
    } else {
      play_pause_mc.gotoAndStop("play");
    }
    };
    // if play/pause button pressed, call this function
    play_pause_mc.onRelease = function() {
    // controll playing status
    if (playing_status) {
      // if status is playing, goto sound equalizer animation pause section.
      sound_animation_mc.gotoAndPlay("pause");
      // save current song position
      current_position = mp3_player.position;
      // stop song
      mp3_player.stop();
      // set current song status "stop"
      playing_status = false;
      // goto play/pause button "play"
      play_pause_mc.gotoAndStop("play_over");
    } else {
      // if current status is pause, goto sound equalizer animation "play" section.
      sound_animation_mc.gotoAndPlay("play");
      // continue play from paused position
      mp3_player.start(current_position/1000, 1);
      // set status to now playing
      playing_status = true;
      // goto play/pause button to "pause"
      play_pause_mc.gotoAndStop("pause_over");
    }
    };
    // if "play next song" button over, call this function
    next_mc.onRollOver = function() {
    next_mc.gotoAndStop("next_over");
    };
    // if "play next song" button rollout, call this function
    next_mc.onRollOut = function() {
    next_mc.gotoAndStop("next");
    };
    // if "play next song" button pressed, call this function
    next_mc.onRelease = function() {
    sound_animation_mc.gotoAndPlay("play");
    // call play next song function
    play_next();
    };
    // show current song time and total song time
    display_time = function () {
    // get current song time (millisecond)
    var current_time:Number = mp3_player.position/1000;
    // get total song time (millisecond)
    var total_time:Number = ((mp3_player.duration/((mp3_player.getBytesLoaded()/mp3_player.getBytesTotal())*100))*100)/1000;
    // convert millisecond to second and add zero for display
    if (current_time<total_time) {
      var current_time_minute:Number = add_zero(Math.floor(current_time/60));
      var current_time_second:Number = add_zero(Math.floor(current_time%60));
      var duration_minute:Number = add_zero(Math.floor(total_time/60));
      var duration_second:Number = add_zero(Math.floor(total_time%60));
      // show playing time and total time
      time_txt.text = current_time_minute+":"+current_time_second+" / "+duration_minute+":"+duration_second;
    }
    // if song position arrive to end of song
    if (Math.floor(current_time) == Math.floor(total_time)) {
      if (current_time<>"0") {
       // if shuffle mode on
       if (shuffle) {
            // play random song
            shuffle_playlist(current_song_number);
       } else {
            // play ordinary song
            play_next();
       }
       clearInterval(timer);
      }
    }
    };
    // add zero to time function
    add_zero = function (num:Number):String {
    return String(num).length == 1 ? "0"+num : num;
    };
    // Define play next song function
    play_next = function () {
    // check end of playlist
    if (current_song_number<play_list.length-1) {
      // next song number
      current_song_number++;
    } else {
      // set song number to first song
      current_song_number = 0;
    }
    // call play song function
    play_song(current_song_number);
    };
    // Define random song number function
    shuffle_playlist = function (old_song_number) {
    var new_song_number:Number = Math.floor(Math.random()*play_list.length);
    // check old song number diffrent from new song number
    while (new_song_number == old_song_number) {
      new_song_number = Math.floor(Math.random()*play_list.length);
    }
    current_song_number = new_song_number;
    // call play song function
    play_song(new_song_number);
    };
    // calculate loader bar percent function
    loader_status = function () {
    // get loaded info
    var amountLoaded:Number = mp3_player.getBytesLoaded()/mp3_player.getBytesTotal();
    // set loader bar width
    loader.loadbar._width = Math.floor(amountLoaded*100);
    // get total song length.
    trueDuration = Math.ceil((mp3_player.duration/((mp3_player.getBytesLoaded()/mp3_player.getBytesTotal())*100))*100);
    if (drag_start == false) {
      // set position loader bar scrub
      loader.scrub._x = (mp3_player.position/trueDuration)*100;
    }
    };
    // create empty movie clip for loader bar scrub
    this.createEmptyMovieClip("vFrame", this.getNextHighestDepth());
    vFrame.onEnterFrame = loader_status;
    // when press to scrub, start drag
    loader.scrub.onPress = function() {
    drag_start = true;
    this.startDrag(false, 0, this._y, 100, this._y);
    };
    // when release scrub, stop dragging and calculate new song position
    loader.scrub.onRelease = loader.scrub.onReleaseOutside=function () {
    loader.scrub.gotoAndStop(1);
    drag_start = false;
    mp3_player.stop();
    // get totoal time
    trueDuration = Math.ceil((mp3_player.duration/((mp3_player.getBytesLoaded()/mp3_player.getBytesTotal())*100))*100);
    // calculate new song position
    current_position = Math.floor(((loader.scrub._x/100)*trueDuration)/1000);
    // start song from new position
    mp3_player.start(current_position, 1);
    this.stopDrag();
    };
    loader.scrub.onRollOver = function() {
    loader.scrub.gotoAndStop(2);
    };
    loader.scrub.onRollOut = function() {
    loader.scrub.gotoAndStop(1);
    };
    // when over the show playlist button
    show_playlist_mc.onRollOver = function() {
    if (play_list_open == false) {
      show_playlist_mc.gotoAndStop("open_over");
    } else {
      show_playlist_mc.gotoAndStop("close_over");
    }
    };
    // when rollout the show playlist button
    show_playlist_mc.onRollOut = function() {
    if (play_list_open == false) {
      show_playlist_mc.gotoAndStop("open");
    } else {
      show_playlist_mc.gotoAndStop("close");
    }
    };
    // when pressed the show playlist button
    show_playlist_mc.onRelease = function() {
    if (move_stop == false) {
      if (play_list_open == false) {
       // playlist movie clip move distance (goto down)
       var distance_y = 155;
       show_playlist_mc.gotoAndStop("close_over");
      } else {
       // playlist movie clip move distance (goto up)
       var distance_y = -155;
       show_playlist_mc.gotoAndStop("open_over");
      }
      // set reverse boolean value
      play_list_open = !play_list_open;
      // call playlist move function..(0.3 = move speed)
      content_move(play_list_mc, distance_y, 0.3);
    }
    };
    // Define Playlist Box (content) main scroller function. (target MC, scroll distance, scroll speed)
    function content_move(target:MovieClip, scroll_distance_y:Number, speed:Number) {
    move_stop = true;
    current_y = target._y;
    target.onEnterFrame = function() {
      if (scroll_distance_y<0) {
       current_scroll_distance = Math.floor(((scroll_distance_y+current_y)-target._y)*speed);
      } else {
       current_scroll_distance = Math.ceil(((scroll_distance_y+current_y)-target._y)*speed);
      }
      if (target._y == scroll_distance_y+current_y) {
       move_stop = false;
       delete target.onEnterFrame;
      }
      target._y += current_scroll_distance;
    };
    }
    // when pressed the mute button
    mute_mc.onRelease = function() {
    if (mute == false) {
      old_volume = player_volume;
      player_volume = 0;
      set_volume(player_volume);
      mute = true;
      mute_mc.gotoAndStop("mute_on_over");
    } else {
      player_volume = old_volume;
      set_volume(player_volume);
      mute = false;
      mute_mc.gotoAndStop("mute_off_over");
    }
    };
    mute_mc.onRollOver = function() {
    if (mute == false) {
      mute_mc.gotoAndStop("mute_off_over");
    } else {
      mute_mc.gotoAndStop("mute_on_over");
    }
    };
    mute_mc.onRollOut = function() {
    if (mute == false) {
      mute_mc.gotoAndStop("mute_off");
    } else {
      mute_mc.gotoAndStop("mute_on");
    }
    };
    set_volume = function (player_volume) {
    mp3_player.setVolume(player_volume);
    volume_control_mc.volume_bar_mc._width = volume_control_mc.slider_mc._x=(player_volume/100)*100;
    };
    shuffle_mc.onRollOver = function() {
    var goto_shuffle:String = shuffle ? "shuffle_on_over" : "shuffle_off_over";
    shuffle_mc.gotoAndStop(goto_shuffle);
    };
    shuffle_mc.onRollOut = function() {
    var goto_shuffle:String = shuffle ? "shuffle_on" : "shuffle_off";
    shuffle_mc.gotoAndStop(goto_shuffle);
    };
    shuffle_mc.onRelease = function() {
    shuffle = !shuffle;
    var goto_shuffle:String = shuffle ? "shuffle_on" : "shuffle_off";
    shuffle_mc.gotoAndStop(goto_shuffle);
    };

  2. #2
    Membre éclairé
    Homme Profil pro
    Concepteur multimédia
    Inscrit en
    Février 2012
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Concepteur multimédia
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2012
    Messages : 55
    Par défaut
    Salut, pourrais-tu préciser ce que tu veux faire...

    La lecture automatique est faite un peu partout dans le code, au chargement des fichiers, quand tu cliques sur le curseur de durée de la chanson etc...

    En fait, si tu veux chercher un peu, il faut trouver les mp3_player.stop();
    et les mp3_player.start([...]);. Ca plus l'aide de flash et tu devrais trouver ton bonheur pour lancer ou stopper les chansons quand tu le souhaites.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mai 2012
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2012
    Messages : 16
    Par défaut
    J'ai le lecteur mp3 qui démarre la playlist automatiquement, et je voudrais désactiver cette fonction, et avoir juste la fonction qui permet la lecture de la playlist par le bouton start.

Discussions similaires

  1. Réponses: 3
    Dernier message: 23/06/2010, 11h25
  2. Comment désactiver la saisie semi-automatique pour un champ
    Par frochard dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 17/01/2008, 11h23
  3. Comment désactiver les actions automatiques de Windows ?
    Par j-phi dans le forum API, COM et SDKs
    Réponses: 7
    Dernier message: 06/01/2005, 12h53
  4. Réponses: 2
    Dernier message: 12/02/2004, 13h07

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo