Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

How to load images from the library (png)?

$
0
0

This is my first time using the forum so sorry if it's not professionally set up. I am trying to make an inventory system and I'm trying to find a way to have a Slot (MovieClip) holding a child of probably another MovieClip witch will display the icon according to whatever is in that Slot... As soon as I figure out how to have a MovieClip display an image and then change that image by loading it from the library, I can finish the rest! So let me try to demonstrate:

 

(Note: This is not actual code, it's just a demonstration of what I'm trying to accomplish)

Item1 = Name: "HP Potion", Icon: "HP_Potion.png"

Item2 = Name: "MP Potion", Icon: "MP_Potion.png"

Item3 = Name: "Sword", Icon: "Sword.png"

Item4 = Name: "Shield", Icon: "Shield.png"

 

Slot1.nameField.text = Item1.Name //HP Potion

Slot1.mc_img = Item1.Icon//HP_Potion.png

 

~Ok so what I am trying to do is see if there is a way to change what image the MovieClip displays, just by code. I don't want to put each individual picture in a frame on the MovieClip's timeline

 

Sorry about not having any code, I've been working on it for a few hours, and I can't find anything online that doesn't say put it in a timeline.

 

If you know how to do what I'm asking with a spritesheet instead of individual images, that's fine too! I'll just have to join all the images together


Viewing all articles
Browse latest Browse all 238792


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>