Dynamic template with dynamic images - How?

Hi,

I want to create a league table dynamic template for an esport event with logo changing options. I followed this guide , but I can’t make it to work. :smiley: I have 8 UILoader, and 8 image variable.

Anyone can help me out how can I do this? 8 image place for 8 image. :smiley:

I would have pointed you on that guide. It seems that something is wrong. Can you share your .fla and .as files?

Yes, I can, but it’s not a great work, because I have problems in the basics, i think. :smile:

https://drive.google.com/file/d/1bxOgccEsrcj-32V70KM_wllzNrxhLoZ4/view?usp=sharing

try this:

var instance1:UILoader;

var mainPath:String = "file:///C:/......";   // your path images

and next

override public function SetData(xmlData:XML):void 
		{			
		   for each (var element:XML in xmlData.children())
		   {
			  if (element.@id == "Team 1") 		
			  {
				instance1.source= mainPath + element.data.@value.toString() + ".png";// or jpg,png .. 
			  }
		   }
		   super.SetData(xmlData);
instance1.Visible = true;

if you want do this automatically, you must create array with 8 elements and then element.@id == array1[0]

https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html

There are a few things going wrong:

  • In your timeline you use classic tweens instead of motion tweens. Clasic tweens have that small vertical separator where ever you change a property. The problem is, that after each of these lines you have a new instance of your object. As the code sets the images at frame 0 the flags will not make it to the instance that you animate in.
  • You need to set an instance name to the “UILoaders” movieClip to be able to set the source properties by code.
  • That instance name must be referenced when you load the flags. So instead of
    logo1.source = element.data.@value.toString(); it would read:
    Instancename.logo1.source = element.data.@value.toString();
  • A perfomance suggestion: Until frame 38 nothing happens in the png animation. The same is true from frame 310 to the end. Get rid of these extra frames.
  • What also can help is only render the area, that has something in it instead of the whole 1920x1080 pixels. But that is something for another post…