# If/Else, Detecting file type, switching frames

**URL:** <https://forum.kirupa.com/t/if-else-detecting-file-type-switching-frames/230502>\
**Category:** flash\
**Created:** [June 26, 2007, 7:28pm UTC](https://forum.kirupa.com/t/if-else-detecting-file-type-switching-frames/230502 "2007-06-26T19:28:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scopa](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@scopa](https://forum.kirupa.com/u/scopa)\
**Post date:** [June 26, 2007, 7:28pm UTC](https://forum.kirupa.com/t/if-else-detecting-file-type-switching-frames/230502/1 "2007-06-26T19:28:52Z")

</div>

Hey guys, I am an actionscript novice, and I am trying to wade through an experts code. There is a problem with the website that I am trying to finish up, and I thought I would give it a go on my own… however I can’t seem to get it right.

Here is the situation:  
I have a website that displays a thumbnail image. The thumbnail can link to a large png, animated swf, or link to nothing.

Under the thumbnail, I have a little icon. “Click to Enlarge” or “Click to Play”.

The Icon is a single movie clip, with the different words on different frames.

Enlarge\_mc:  
Frame 1 = Click To Enlarge  
Frame 2 = Click To Play

So, what I want to do is add two more states to the Enlarge\_mc.  
Frame 1 = Click To Enlarge  
Frame 2 = Click To Play  
Frame 3 = Click Links Below  
Frame 4 = \<display nothing\>

Currently, I have an external .as file with the following code:

```auto

    public function load ( url : String, locNum : Number, inAutoPlay : Boolean, inHideControls : Boolean ) : Void {
        
        if ( inHideControls ) hideControls();
        
        //trace( 'load media: ' + url + ' into loc num : ' + locNum + 'from : ' + mc );
        
        for ( var i = 0; i < 50; i++ ) {
            loc['image_' + i].stopTween();
            loc['image_' + i].alphaTo( 0, .25, ani );
        }
        
        var loadCr : MovieClip = loc['image_' + locNum];
        var loadTo : MovieClip = ( loadCr != undefined ) ? loadCr : loc.createEmptyMovieClip( 'image_' + locNum, locNum );
        
        if ( url.indexOf( '.swf' ) > -1 ) {
        
            player._visible = true;
            player.loadFile( url, true )
            dispatchEvent( { type : 'toggleEnlargeButton', target : this, frame : 2, enabled : true } );
        
        } else if ( url.length == 0 ) {
            
            dispatchEvent( { type : 'toggleEnlargeButton', target : this, frame : 3, enabled : false } );
            
        } else if ( url.toLowerCase() == 'no_file' ) {
            
            dispatchEvent( { type : 'toggleEnlargeButton', target : this, frame : 4, enabled : false } );
            
        } else {
        
            dispatchEvent( { type : 'toggleEnlargeButton', target : this, frame : 1, enabled : true } );
            player._visible = false;
            if ( loadCr == undefined ) {
                mcl.loadClip( url, loadTo );
            } else {
                loadTo.alphaTo( 100, .25, ani, .25 );
            }
        }
    }

```

Is there any reason why this wouldn’t work? Because it still switches between frames 1 and 2, but refuses to go to frame 3 or 4.

Oh, one more thing.

The movie gets the file information from an xml file with the following code:

```auto

<images>
     <image file = "my_thumbnail_01.png" enlarged = "large_01.png" />
     <image file = "my_thumbnail_02.png" enlarged = "large_02.swf" />
<image file = "my_thumbnail_03.png" enlarged = "" />
</images>

```
