Skip to main content
Inspiring
December 28, 2022
Question

AS 3.0 textField

  • December 28, 2022
  • 2 replies
  • 897 views

Thank you always for your sincere answers
This is a question about AS3.0 textfield
-------------------------------------------------- --------------------
var n:Number;
var sm:Array; (sound list)
var completed:Array; (sound completed list)

 

1. textbox draw (width 200, height 400)
fieldType - dynamic
instance - textList


2. When the sound ends
completed. push(sm[n]);


3. When the button is clicked
completedList();
function completedList():void {
var tx:String;
var addTx:String;
for (var i:uint=0; i<completed.length; i++) {
tx = (i<9) ? String(" "+(i+1)) : String(i+1);
addTx = tx+ " - "+completed[i]+"\n";
if (i==0) textList.appendText("----- Music Played List ----- \n");
textList. appendText(addTx);
}
}
-------------------------------------------------- --------------------------
Click on one of the rows to play that list song again.
4. How can I select one of each row of the textList in this case
5. How to scroll when the number of rows is out of range of the textbox

 

Politely contact us to solve the problem
thank you

 

    This topic has been closed for replies.

    2 replies

    kglad
    Adobe Expert
    December 28, 2022

    and what's the problem that you see?  an error message?  something else?

    JoãoCésar17023019
    Inspiring
    December 28, 2022

    Hi.

     

    Can you show your actual code and possibly some visuals of what you're doing?

    Regards,

    JC

    Inspiring
    December 28, 2022

    When you click the music button, the list of played music is listed on the right.
    How to select one of them and play it again...
    And if the list has more textfield, you can scroll.
    I would like to know how

     

    * It's Google translation, so please understand if it's not enough

     

    thank you

     

    ---------------------------------------------------------

    var channel:SoundChannel;
    var pausePosition:Number;
    var sound:Sound;
    var ptrans:SoundTransform;
    var n:uint;
    var p:uint;
    var v:uint = 0;
    var count:uint = 0;
    var loopCount:uint = 0;
    var completed:Array = [];

     

    sm.sort();

    for (var i:uint=0; i < sm.length; i++) {
    cb.addItem({label:sm[i],data:i});
    }


    // Music Start ===================================================

    function music_start(url:String):void {

    if (channel) { channel.stop(); }

    n = p = sm.indexOf(url);

    url = dm + url + ".mp3";
    var mySound:Sound = new Sound(new URLRequest(url));
    var myChannel:SoundChannel = new SoundChannel();

    myChannel = mySound.play(0);

    sound = mySound;
    channel = myChannel;

    channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);

    }

    var delayTimer:Timer = new Timer(500, 1);

    function soundCompleteHandler(event:Event):void {
    delayTimer.addEventListener(TimerEvent.TIMER, indexReplay);
    delayTimer.start();
    }

     

    function indexReplay(event:TimerEvent):void {
    completed.push(sm[n]);
    if (completed.length>22) completed.shift();

    if ((listOK) && (completed.length > 0)) {
    textList.text = String(" ");
    completedList();
    }

    music_start(sm[n]);

    }


    pList_btn.addEventListener(MouseEvent.CLICK,completedListOK);
    pList_btn.buttonMode = true;
    pList_btn.gotoAndStop(1);
    var listOK:Boolean = false;

    function completedListOK(evt:MouseEvent):void {
    listOK = !listOK;
    if (listOK) {
    pList_btn.gotoAndStop(2);
    completedList();
    } else {
    pList_btn.gotoAndStop(1);
    textList.text = String(" ");
    }

    }
    function completedList():void {

    var tx:String;
    var addTx:String;
    for (var i:uint=0; i<completed.length; i++) {
    tx = (i<9) ? String(" "+(i+1)) : String(i+1);
    addTx = tx+ " - "+completed[i]+"\n";
    if (i==0) textList.appendText(" ----- Music Played List ----- \n");
    textList.appendText(addTx);
    }

    }

     

     

    Inspiring
    December 28, 2022

    Thanks.

     

    Please upload the FLA to a file sharing service like Creative Cloud, Google Drive, Dropbox, OnDrive, WeTransfer, and so on, and paste the link here.


    https://drive.google.com/file/d/1VRyZTZlolsddCMuZcbIQ-A1vKZOGJ0LN/view?usp=share_link