# \[flash cs3 AS2\] arg nooby need help making a check

**URL:** https://forum.kirupa.com/t/flash-cs3-as2-arg-nooby-need-help-making-a-check/275746
**Category:** flash
**Created:** [November 18, 2008, 9:10am UTC](https://forum.kirupa.com/t/flash-cs3-as2-arg-nooby-need-help-making-a-check/275746 "2008-11-18T09:10:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ayubu](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@ayubu](https://forum.kirupa.com/u/ayubu)
#### Post date: [November 18, 2008, 9:10am UTC](https://forum.kirupa.com/t/flash-cs3-as2-arg-nooby-need-help-making-a-check/275746/1 "2008-11-18T09:10:18Z")

</div>

hiya im making a music player with flash and its just getting songs at random from a php script which is outputing all the song files in xml format it works except it plays the same song twice sometimes im not sure how to write a check to say if last song played = current song then pick a new song

any help would be appreciated cheers

i have a link going to my test page which is [http://www.aaron-m.co.nz/new/](http://www.aaron-m.co.nz/new/) and the .fla file link is [http://www.aaron-m.co.nz/new/index.fla](http://www.aaron-m.co.nz/new/index.fla)

i have the actionscript in 2 frames,  
heres the script from the first

```php
mymusic = new XML();
mymusic.ignoreWhite = true;
mymusic.load("index2.php");
mymusic.onLoad = function(success) {
songnumber = this.firstChild.childNodes.length - 1;

var mymusics = mymusic.firstChild.childNodes;
var count1 = music_frame = Math.ceil(Math.random()*songnumber);
numb3r.text = count1
trace(count1)
var songs = mymusics[count1].firstChild.nodeValue;
names.text = songs;
}

```

here is the second frame

```php
stop();
trace(names.text);
stopAllSounds();
var mysound:Sound = new Sound();
var song1 = names.text
mysound.loadSound(song1, true); 
    mySound.start(0);
    test.text = song1;
mysound.onSoundComplete = function(){_root.gotoAndPlay(1)};

```

i have a basic button which is just for testing purposes its

```php
on(release){
    gotoAndPlay(1);
}

```

and the php script which is outputting the music files in the directory

```php
<?
header('content-type: text/xml');
echo "<?xml version=\"1.0\"?>";
 
$dir = ".";
$files = scandir($dir);

printf( "<music>");
foreach($files as $key => $value){
    if(ereg('mp3$',$value)){
        printf( "<song>".$value."</song>
");
    }
}

printf( "</music>");
?> 

```
