# AS3 Active opacity state for imported movie clips

**URL:** <https://forum.kirupa.com/t/as3-active-opacity-state-for-imported-movie-clips/328990>\
**Category:** flash\
**Created:** [July 10, 2012, 11:24am UTC](https://forum.kirupa.com/t/as3-active-opacity-state-for-imported-movie-clips/328990 "2012-07-10T11:24:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trizwazere](https://avatars.discourse-cdn.com/v4/letter/t/3da27b/32.png) [@trizwazere](https://forum.kirupa.com/u/trizwazere)\
**Post date:** [July 10, 2012, 11:24am UTC](https://forum.kirupa.com/t/as3-active-opacity-state-for-imported-movie-clips/328990/1 "2012-07-10T11:24:37Z")

</div>

You’ll have to excuse me, I’m ‘VERY’ new to AS3 and so this may be a silly question:

I’m working on an interactive map at the mo. The location icons are all imported separately and placed on top of the map. All I’m trying to do is create an active state on these location icons. So that when a user clicks on one it’s alpha property is set to 0 and all the others are set to 1, but I can’t for the life of me seem to be able to target the imported movie clips correctly.

This is the code that’s placing the icons (landmarkIcon) onto the map, but I can’t get the click function to change their alpha properties. Any help would be great.

```
    // locating the landmarks on the map's container
    public function locateLandmarks():void {
        for (var i:int = 0; i &lt; landmark.length; i++) {
            var landmarkIcon:MovieClip = new Landmark(landmark*.icon);
            landmarkIcon.x = landmark*.x;
            landmarkIcon.y = landmark*.y;
            landmarkIcon.id = i;
            //landmarkIcon.alpha = 0;
            landmarkIcon.addEventListener(MouseEvent.CLICK, landmarkClick);
            landmarkIcon.addEventListener(MouseEvent.ROLL_OVER , landmarkOver);
            landmarkIcon.addEventListener(MouseEvent.ROLL_OUT, landmarkOut);
            MovieClip(parent).pan.landmarks.addChild(landmarkI con);
            
            var movname = landmarkIcon.name;
            
        // Click Function
        
        function landmarkClick(e:MouseEvent):void {     
        var id:int = e.target.parent.parent.parent.id;
        gotoLandmark(id);
        // navigate to target url
        if (landmark[id].target != undefined) MovieClip(root).testit.gotoAndPlay(landmark[id].target);

        for(var i:int=0;i&lt;landmark.length;i++)
        {
        if(i==e.currentTarget.id)
        landmarkIcon*.alpha = 0;
        else
        landmarkIcon*.alpha = 1;
        }
        
        }
    
        }
    }
```
