# \[help\] Load images and load AS for button?

**URL:** <https://forum.kirupa.com/t/help-load-images-and-load-as-for-button/221679>\
**Category:** flash\
**Created:** [April 6, 2007, 9:22am UTC](https://forum.kirupa.com/t/help-load-images-and-load-as-for-button/221679 "2007-04-06T09:22:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjj](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@cjj](https://forum.kirupa.com/u/cjj)\
**Post date:** [April 6, 2007, 9:22am UTC](https://forum.kirupa.com/t/help-load-images-and-load-as-for-button/221679/1 "2007-04-06T09:22:37Z")

</div>

I have successfully dynamically loaded Jpegs into my flash document(using PHP), but then I have another small problem…

When I dynamically load the image (example: image\_icon\_bluesky.jpg) I then need to tell the MC that is holding the loaded image that it needs to do this…  
on (release) {  
\_root.image\_bluesky.alpha = 100;  
}

SO basically every time a new image is loaded in my sort of “loop” script. I need to tell the image that it needs to put specific code onto the MC using specific “image” details for that specific image.

I hope this is clear. Basically what I’m trying to do…

On my flash stage I already have MC’s that have their alpha properties set to “0”. Lets say there are 3 images. One MC is called Blue, other is called Red and the last one is called Yellow.

Now using AS + PHP I have dynamically loaded 3 Jpeg’s …

_myData = new LoadVars()  
myData.load(“theitems.php”)  
myData.ref = this  
myData.onLoad = function(succes){  
if(succes){  
for(var i=0; i\<this.cant; i++){  
this.ref[“holder\_mc”+i].loadMovie(this[“item”+i])  
}  
} else trace(“Error loading data”)  
}_

In the PHP script a query takes the info from a database. In this case there are 3 images to load. Let’s say they are called ‘Blue.jpg’, ‘Red.jpg’ and ‘Yellow.jpg’.

Okay now ideally I need to find someway of sending the “link” with the image. So that when ‘Blue.jpg’ loads on the stage it knows it’s AS needs to be  
_on (release) {  
\_root.blue.alpha = 100;  
}_

and so on for each image…I have tried to explain this as well as I possibly can. I just wanna know if this is possible or if there is a simple way of doing it. I am so stressed by this that I might not even be thinking clearly. I appreciate any replies on the subject!
