Image Instance not created during template generation

I want an instance for a flag image. So have used a flag holding image “flag.png” and created a symbol from it (Type: MovieClip, InstanceName: Flag) - however it doesn’t generate this InstanceName during template creation…

The symbol is within a symbol, but that shouldn’t matter (have tried in the top layer)…

On a positive note, I managed to fix a different issue I was having thanks to some posts on here!

Please share a simple file that demonstrates your problem, it will be easier to debug.

1 Like

FLA file:

FA file:

I’m guessing it’s because I haven’t started using E2C libraries yet?

@tomtailford Do you want to replace the flag with another file based on template fields?
Do you want it replaced with an external file (eg png from folder) or an internal asset?

My end goal is to use data to replace all the instances - am happy to create all the flags in the template if that’s required, or put them in a folder :slight_smile:

Take a look at this tutorial:

It was written by @didikunz and covers loading images from an external folder and will probably be the easiest way to go for you.

Take a look and feel free to ask more questions.

Thanks very much, so was able to create a UILoader & give it an instance name.

I then created the .ft file next to the template (in the CCG templates directory) and modified the lines thinking I could then use Key/Value within the CCG client… but I’m guessing it doesn’t quite work like that?!

I’m guessing I now need to learn how to send XML data to the template?! Or am I way off…

This has probably been asked multiple times before, but I couldn’t find a tutorial that explains all the bits (there’s plenty of examples replacing text, but not images!)

Do you want to share your source again and I’ll take a look.

If you carefully follow my tutorial linked above you get all the answers.

I think I’ve followed it OK - but it’s now inserting the XML data into the template itself (or if it works should I be able to do this from CCG client with Key/Value?)

I have modified the file though, so I could quite easily have broken something :smiley:

Hi @tomtailford

So two very simple fixes.

You have written the class but not applied it to the document. You need to insert the class name into your document properties:

The second fix is that the image isn’t in the root document but in an object. So you need to give the Box2 an instance name, eg. FlagBox and then in the class you should apply the source like this:

FlagBox.flag.source =;

And then yes you should be able to use the key- value in the client with flag as the key and a file:// url as the value.

Thanks very much.

I’ve applied the class, relatively simple - and was in @didikunz tutorial (however I missed due to lack of understanding / detail on how to do it for a complete amateur!)

I was able to use Key/Value by dropping the UILoader into it’s own layer - however animation didn’t seem to work. Having done a bit more research - it seems this is due to AS3 not liking classical tweens, so I’ve made a motion tween - which previews nicely in Animate.

However, it’s not working in CCG.

Render - Cache as bitmap / Transparent (also tried Opaque)

I thought maybe it’s because I wasn’t nesting in a symbol. So I tired this too, however when compiling using your code example I get “1120: Access of undefined property newsymbol.”

				  newsymbol.newflag.source =;

Symbol instance name = newsymbol
UILoader name = newflag

Side note - it will render the image providing the UILoader is stationary… so I must have done something wrong with my animation?