Background info : I’m trying to be able to load the shape of a fruit and the color of the fruit as two separate Sprites from a SWC file using the name distinguish which Sprite to load.
This is so I can have a apple shape with orange skin or the other way around. Im hoping this well make it easy down the line to simply add the texture of a strawberry but have it masked on an banana shape or any other shape.
But…
From my understanding this code
tempClass = getDefinitionByName(_model._skin.name) as Class;
_skin = new tempClass();
tempClass = getDefinitionByName(_model._body._structure.name) as Class;
_body = new tempClass();
Gives me this ->
:trout:
ReferenceError: Error #1065: Variable Apple_Skin is not defined.
at global/flash.utils::getDefinitionByName()
at classes.creature.mvc::View()
at classes::Main()
at battleproto_fla::MainTimeline/frame1()
:trout:
unless I have the names of the classes explicitly written out before like so
Apple_Skin; //green color Sprite
Apple_Body; //apple shape
Orange_Skin; //orange colored sprite
Orange_Body //orange shape
tempClass = getDefinitionByName(_model._skin.name) as Class;
_skin = new tempClass();
tempClass = getDefinitionByName(_model._body._structure.name) as Class;
_body = new tempClass();
I’d like to be able to easily add to the list of fruits but I dont want to manually type out each one. Is there an easier way to handle this so it wont be so cluttered? Thanks in advance wise ones :yoda:
:mu: DaChillWizard :mu: