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

Flash Pascal Discussion :

Lecteur mp3 et ouverture de fichiers


Sujet :

Flash Pascal

  1. #1
    Membre chevronné
    Avatar de Archimède
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2005
    Messages
    1 644
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Charente Maritime (Poitou Charente)

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2005
    Messages : 1 644
    Points : 1 975
    Points
    1 975
    Par défaut Lecteur mp3 et ouverture de fichiers
    ci-joint un essai à partir de sound... Paul nous tend la perche

    J'ai fait en fonction des outils que j'avais pour l'instant.

    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
     
    program SoundPlayer2;
     
    {$FRAME_WIDTH 550}
    {$FRAME_HEIGHT 100}
    {$FRAME_RATE 12}
    {$BACKGROUND $FFFFFF}
     
    uses
      Flash8,UVideoButton,Utrack;
     
    type
     
    TTrackbar1=class(TTrackbar)
     procedure onChange;override;
    end;
     
    TJauge=class(movieclip)
     e:number;
     mv:movieclip;
     constructor create(left,top,w,h:number; aowner:movieclip);
    end;
     
    MyScreen=class(movieclip)
       debut:boolean;
       tempo:number;
       btplay,btstop:TButton;
       constructor Create;
       procedure onPlay(sender:TObject);
       procedure onStop(sender:TObject);
       procedure onEnterFrame;override;
    end;
     
    var  player: Sound;
         Trackbar:TTrackbar1;
         jaugeprogress:TJauge;
     
    Constructor TJauge.create(left,top,w,h:number; aowner:movieclip);
    begin
     inherited Create(aowner,'jauge',aowner.getNextHighestDepth);
     _x:=left;
     _y:=top;
     linestyle(2,$A6D7F1);
     lineto(w,0);
     lineto(w,h);
     lineto(0,h);
     lineto(0,0);
     e:=h;
     
     mv:=movieclip.create(self,'mv',0);
     with mv do
     begin
      beginfill($80BDBE);
      lineto(w,0);
      lineto(w,e);
      lineto(0,e);
     end;
    end;
     
    Constructor MyScreen.Create;
    begin
     inherited Create(_root,'screen',0);
     btplay:=TButton.Create(self,1,10,10,35,35);
     btstop:=TButton.Create(self,2,60,10,35,35);
     player := Sound.Create();
     btplay.onClick:=onPlay;
     btStop.onClick:=onStop;
     
     Trackbar:=TTrackbar1.Create(self,200,0,100,70,'horizontal');
     with Trackbar do
      begin
       _x:=125;
       _y:=20;
     end;
     
     jaugeprogress:=TJauge.Create(10,80,stage.width-20,5,self);
     
     player.loadSound('Klaus.mp3');
     tempo:=0;
     debut:=true;
    end;
     
    procedure MyScreen.onEnterFrame;
    begin
     if debut=false then jaugeprogress.mv._xscale:=player.position*100/player.duration else jaugeprogress.mv._xscale:=0;
     tempo:=player.position/1000;
    end;
     
    procedure MyScreen.onPlay(sender:TObject);
    begin
     with btplay.skin1 do _visible:=not _visible;
     with btplay.skin2 do _visible:=not _visible;
     if btplay.skin2._visible then
     begin
       if debut then
       begin
        player.start(0);
        debut:=false;
       end else player.start(tempo);
     end
       else player.stop;
    end;
     
    procedure MyScreen.onStop(sender:TObject);
    begin
     tempo:=0;
     btplay.skin2._visible:=false;
     btplay.skin1._visible:=true;
     player.stop;
     debut:=true;
    end;
     
    Procedure TTrackbar1.onChange;
    begin
     player.setVolume(Trackbar.position);
     
    end;
     
    begin
       MyScreen.Create;
    end.
    utrack :
    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
     
    unit UTrack;
     
    interface
    uses Flash8;
     
     
    type
     
       TTrackcur=class(MovieClip)
        orientation:string;
        xmouse,ymouse,trackmin,trackmax:number;
        xcur,ycur:Integer;
        downcur:Boolean;
        Procedure circle(Cx,Cy,Radius:number);
        constructor Create(AOWNER:Movieclip;trmin,trmax:number);
        procedure onPress;override;
        procedure onEnterFrame;override;
        procedure onMouseUp;override;
       end;
     
       TTrackbar=class(MovieClip)
       private
        w,h:number;
        state:string;
        procedure Roundrect(x,y,w,h,radius:number);
        procedure DrawTrackbar(Width,Height:number);
       public
        position:number;
        cur: TTrackcur;
        procedure onChange;virtual;
        constructor Create(AOWNER:Movieclip;FTaille,trmin,trmax,posi:number;Kind:string);
       end;
     
    implementation
     
     
    constructor TTrackcur.create(AOWNER:Movieclip;trmin,trmax:number);
     var matrix: Flash8.Matrix;
    begin
      inherited Create(AOWNER,'cur',AOWNER.getNextHighestDepth);
      matrix := Flash8.Matrix.Create();
      matrix.createBox(1,1,0,10,14);
      linestyle(1,$87B6B7);
      beginGradientFill('radial',[$008080,clwhite],[100,100],[0,14],matrix);
      Circle(6,6,15);
      downcur:=false;
      xmouse:=0;
      ymouse:=0;
      trackmin:=trmin;
      trackmax:=trmax;
    end;
     
    constructor TTrackbar.Create(AOWNER:Movieclip;FTaille,trmin,trmax,posi:number;Kind:string);
    begin
     inherited Create(AOWNER,'trackbar',AOWNER.getNextHighestDepth);
     w:=FTaille;
     state:=Kind;
     DrawTrackBar(w,12);
     cur:=TTrackcur.Create(self,trmin,trmax);
     cur.orientation:=Kind;
     position:=posi;
     if kind='horizontal' then
     begin
      cur._x:=(posi-trmin)*w/(trmax-trmin);
      cur._y:=0;
     end else
     if kind='vertical' then
     begin
      cur._y:=(trmax-posi)*w/(trmax-trmin);
      cur._x:=0;
     end;
    end;
     
    procedure TTrackbar.DrawTrackbar(Width, Height: number);
    var matrix: Flash8.Matrix;
    begin
     matrix := Flash8.Matrix.Create();
     if state='horizontal' then
     begin
      matrix.createGradientBox(width, height, Math.PI/2, 0, 0);
      beginGradientFill('linear',[$deedf6,$c4e5f6,$98d1ef,$66afd7],[100,100,100,100],[8,64,127,255],matrix);
      linestyle(2,$98d1ef);
      RoundRect(0,0,width,height,height/2);
     end else if state='vertical' then
     begin
      matrix.createGradientBox(height,width,0, 0, 0);
      beginGradientFill('linear',[$deedf6,$c4e5f6,$98d1ef,$66afd7],[100,100,100,100],[8,64,127,255],matrix);
      RoundRect(0,0,height,width,height/2);
      linestyle(2,$98d1ef);
     end;
    end;
     
    procedure  TTrackcur.onPress;
    begin
     downcur:=true;
     xmouse:=_xmouse;
     ymouse:=_ymouse;
    end;
     
    procedure  TTrackcur.onEnterFrame;
    var tr:TTrackbar;
    begin
         tr:= TTrackbar(_parent);
     
         if downcur then
         if orientation='horizontal' then
         begin
          _x:= _x + _xmouse -xmouse;
          if _x<0 then _x:=0;
          if _x>tr.w then _x:=tr.w;
          tr.position:=_x*(trackmax-trackmin)/tr.w+trackmin;
         end
         else if orientation='vertical' then
         begin
          _y:= _y +_ymouse -ymouse;
          if _y<0 then _y:=0;
          if _y>tr.w then _y:=tr.w;
          tr.position:=trackmax-(_y*(trackmax-trackmin)/tr.w);
         end;
         tr.onChange;
    end;
     
     
     
    procedure  TTrackcur.onMouseUp;
    begin
     downcur:=false;
    end;
     
    procedure TTrackbar.Roundrect(x,y,w,h,radius:number);
    var
     ra,b:number;
    begin
      ra := x + w;
      b := y + h;
      moveTo(x+radius, y);
      lineTo(ra-radius, y);
      CurveTo(ra,y, ra, y+radius);
      lineTo(ra, y+h-radius);
      CurveTo(ra, b, ra-radius, b);
      lineTo(x+radius, b);
      CurveTo(x, b,x, b-radius);
      lineTo(x, y+radius);
      CurveTo(x, y, x+radius,y);
    end;
     
    Procedure TTrackcur.circle(Cx,Cy,Radius:number);
    var a,b,R: number;
    begin
      R:=Radius;
      a:= R * 0.414213562;
      b:= R * 0.707106781;
      moveTo(Cx+R,Cy);
      CurveTo(Cx+ R, Cy+-a, Cx+b,Cy -b);
      CurveTo(Cx+ a,Cy-R,Cx,Cy -r);
      CurveTo(Cx-a,Cy -R,Cx-b,Cy -b);
      CurveTo(Cx-R, Cy-a,Cx-R,Cy);
      CurveTo(Cx-R,Cy+a,Cx-b,Cy+b);
      CurveTo(Cx-a,Cy +R,Cx,Cy+r);
      CurveTo(Cx+a,Cy +R,Cx+b,Cy+b);
      CurveTo(Cx+R,Cy+a,Cx+R,Cy);
    end;
     
    procedure TTrackbar.onChange;
    begin
    end;
     
    end.
    uvideobutton :

    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
     
    Unit UVideoButton;
    interface
     
    uses Flash8;
     
    type
      TButton=class(movieClip)
       Private
        w,h,fonction:number;
        procedure skin;
        procedure skin1playpause;
        procedure skin2stop;
        procedure skin3back;
        procedure skin4up;
       Public
        skin1,Skin2:movieclip;
        procedure onPress;override;
        procedure onClick;virtual;
        Constructor Create(parent:movieclip;nbskin,left,top,width,height:number);
      end;
     
    implementation
     
    Constructor TButton.Create(parent:movieclip;nbskin,left,top,width,height:number);
    begin
      inherited Create(parent,'button', movieclip(parent).getNextHighestDepth());
      w:=width;
      h:=height;
      fonction:=nbskin;
      linestyle(3,$e0e0e0);
      BeginFill($c0c0c0);
      moveto(0,h);
      lineto(0,0);
      lineto(w,0);
      linestyle(3,$808080);
      lineto(w,h);
      lineto(0,h);
      skin;
      _x:=left;
      _y:=top;
    end;
     
    Procedure TButton. skin1playpause;
    begin
      skin1:=movieclip.Create(self,'skin1',1);
      skin2:=movieclip.Create(self,'skin2',2);
      With skin1 do
      begin
       BeginFill(clBlack);
       linestyle(2,clBlack);
       moveto(w/4,h/4);
       lineto(3*w/4,h/2);
       lineto(w/4,3*h/4);
      end;
      With skin2 do
      begin
       linestyle(6,clBlack);
       moveto(7*w/20,h/4);
       lineto(7*w/20,3*h/4);
       moveto(13*w/20,h/4);
       lineto(13*w/20,3*h/4);
       _visible:=false;
      end;
    end;
     
    Procedure TButton. skin2stop;
    begin
      BeginFill(clBlack);
      linestyle(2,clBlack);
      moveto(w/4,h/4);
      lineto(3*w/4,h/4);
      lineto(3*w/4,3*h/4);
      lineto(w/4,3*h/4);
      lineto(w/4,h/4);
    end;
     
    procedure TButton.skin3back;
    begin
      linestyle(4,clBlack);
      moveto(3*w/4,h/4);
      Lineto(w/4,h/2);
      moveto(w/4,h/2);
      Lineto(3*w/4,3*h/4);
    end;
     
    procedure TButton.skin4up;
    begin
     linestyle(4,clBlack);
     moveto(w/4,h/4);
     Lineto(3*w/4,h/2);
     moveto(3*w/4,h/2);
     Lineto(w/4,3*h/4);
    end;
     
    procedure TButton.skin;
    begin
     case fonction of
      1:skin1playpause;
      2:skin2stop;
      3:skin3back;
      4:skin4up;
     end;
    end;
     
    procedure TButton.onClick;
    begin
    end;
     
    procedure TButton.onPress;
    begin
     onClick;
    end;
     
    end.
    Ma question est comment faire l'équivalent d'une opendialog pour ouvrir un fichier mp3 à partir du lecteur ?


  2. #2
    Rédacteur/Modérateur

    Avatar de Roland Chastain
    Homme Profil pro
    Enseignant
    Inscrit en
    Décembre 2011
    Messages
    4 072
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Décembre 2011
    Messages : 4 072
    Points : 15 462
    Points
    15 462
    Billets dans le blog
    9
    Par défaut
    Très joli !

    Pour accéder aux fichiers, je pense qu'il faut que les chemins soient dans le programme.
    Mon site personnel consacré à MSEide+MSEgui : msegui.net

  3. #3
    Membre chevronné
    Avatar de Archimède
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2005
    Messages
    1 644
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Charente Maritime (Poitou Charente)

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2005
    Messages : 1 644
    Points : 1 975
    Points
    1 975
    Par défaut
    Citation Envoyé par Roland Chastain Voir le message
    Très joli !

    Pour accéder aux fichiers, je pense qu'il faut que les chemins soient dans le programme.
    Merci, pour l'instant, j'ai essayé de mettre en situation quelques méthodes de Sound sans chercher à faire dans l'esthétique...

    Il reste d'autres méthodes à mettre en oeuvre... le contrôle de chaque enceinte etc...

    il doit y avoir moyen d'ouvrir un fichier sur le poste client... je regarde

  4. #4
    Membre chevronné
    Avatar de Archimède
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2005
    Messages
    1 644
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Charente Maritime (Poitou Charente)

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2005
    Messages : 1 644
    Points : 1 975
    Points
    1 975
    Par défaut
    Effectivement à part lire des fichiers à partir de son site, on ne peut rien faire d'autre. Ce qui parait logique cependant...

    a+

  5. #5
    Membre chevronné
    Avatar de Archimède
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2005
    Messages
    1 644
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Charente Maritime (Poitou Charente)

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2005
    Messages : 1 644
    Points : 1 975
    Points
    1 975
    Par défaut
    Pour une lecture en boucle :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     player.onSoundComplete:=docomplete;
    avec :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    procedure MyScreen.docomplete(sender:TObject);
    begin
     player.start;
    end;
    On ajoute un CheckBox pour choisir l'option...

  6. #6
    Expert éminent sénior
    Avatar de Paul TOTH
    Homme Profil pro
    Freelance
    Inscrit en
    Novembre 2002
    Messages
    8 964
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Freelance
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2002
    Messages : 8 964
    Points : 28 445
    Points
    28 445
    Par défaut
    je confirme pour avoir accès au système de fichier local il faut faire de l'ActionScript3...peut-être un jour en FlashPascal 3
    Developpez.com: Mes articles, forum FlashPascal
    Entreprise: Execute SARL
    Le Store Excute Store

  7. #7
    Membre chevronné
    Avatar de Archimède
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2005
    Messages
    1 644
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Charente Maritime (Poitou Charente)

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Avril 2005
    Messages : 1 644
    Points : 1 975
    Points
    1 975
    Par défaut
    Merci pour la confirmation...

    a+

Discussions similaires

  1. Réponses: 5
    Dernier message: 06/06/2011, 00h36
  2. Réponses: 10
    Dernier message: 30/07/2007, 15h53
  3. Réponses: 2
    Dernier message: 10/04/2007, 23h07
  4. Réponses: 2
    Dernier message: 26/02/2003, 15h18
  5. [VBA-E] Evenement ouverture de fichier
    Par gjeff dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 13/12/2002, 09h42

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