Hey guys,
Been looking at this for some hours now and dont seem to find any sensible explanation.
Created a healthbar that calculates the health percentage and scales my movieclip accordingly with healthbar1.scaleX = percentHP;
But when i push the template from the client with any value on that instance the template does not load the MovieClip. Now, if i push the template without any values assigned it works perfectly.
the element.@id == “health1” and the animation is motion tween all the way with everything starting at frame 0 (1)
package
{
import flash.display.MovieClip;
import se.svt.caspar.ICommunicationManager;
import se.svt.caspar.IRegisteredDataSharer;
import se.svt.caspar.template.CasparTemplate;
public class side_overlay3 extends CasparTemplate
{
private const customParameterDescription:XML =
<parameters>
<parameter id="health1" type="string" info="Health player 1" />
</parameters>;
override public function SetData(xmlData:XML):void
{
for each (var element:XML in xmlData.children())
{
if (element.@id == "health1")
var maxHP:int = 100;
var health1:String = element.data.@value.toString();
var int_health1:int = int(health1);
if (int_health1 < 100){
var percentHP:Number = int_health1 / maxHP;
healthbar1.scaleX = percentHP;
}
if (int_health1 <= 0){
healthbar1.scaleX = 0;
}
if (int_health1 == maxHP){
healthbar1.scaleX = 1;
}
}
}
super.SetData(xmlData);
}
}
}
I am new to AS3 so be kind