It is currently 29 Mar 2017, 17:56



HELP NEEDED: Flash UILoader animation (Alpha)

Videos, graphics, Flash templates – how to create and play them using CasparCG

Moderators: Macey, Jonas Hummelstrand, didikunz

HELP NEEDED: Flash UILoader animation (Alpha)

Postby piotrszmidt » 13 Mar 2017, 11:13

I made a simple template - just like in Wiki tutorial - and it works fine. I can load exteranal image throug f0 field in caspar clinet.

Porblem is that i want to implement option that UILoader element will fade in or out. Nomraly in flash i would use Classic Animatuion using ALPHA 0->100.

Im not good at flash at all :( just started learning for Caspar template purposes. My porblem is that when i convert UILoader element into MovieClip Symbol or Graphic Symbol it doesynt load at all.

here is my ActionScript code:

Code: Select all
package
{
   import flash.display.MovieClip;
   import se.svt.caspar.ICommunicationManager;
   import se.svt.caspar.IRegisteredDataSharer;
   import se.svt.caspar.template.CasparTemplate;
     
   public class avatar extends CasparTemplate
   {
      private const customParameterDescription:XML =    
      <parameters>
            <parameter id="image" type="string" info="File URL for Flag Home" />
         </parameters>;
      
      override public function SetData(xmlData:XML):void
      {         
         for each (var element:XML in xmlData.children())
         {
           if (element.@id == "image")       
           {
              Image1.source = element.data.@value.toString();
           }
         }
         super.SetData(xmlData);      
      }
   }
}


here is the link to the package of my template: https://we.tl/Bd4BceEeE0 (include FLA, tf, as files)

Can I ask somebody to explain me step by step how to make it fade in a realy simple way so i can use it later in other templates?
User avatar
piotrszmidt
 
Posts: 44
Joined: 27 Mar 2013, 12:29
Location: Warsaw, Poland

Re: HELP NEEDED: Flash UILoader animation (Alpha)

Postby didikunz » 13 Mar 2017, 12:23

That is not that hard. The best way of doing it is, by the use of an ActionScript animation library like Tweener or Greensock, to animate stuff from code.

Here http://www.casparcg.com/wiki/Content_/_Media#Creating_Advanced_Flash_Templates you find other procedures you can overwrite, beside SetData. There is one called postInitialize that will be called after the template has been loaded by Caspar, but before anything gets displayed. That is the place to add something like
Code: Select all
override public function postInitialize():void {
{
   Image1.alpha = 0;
}


Thaen inside the play function you animate the alpha value from 0.0 to 1.0 and inside stop from 1.0 to 0.0 using a calll to the animations library's tween function.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3401
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: HELP NEEDED: Flash UILoader animation (Alpha)

Postby piotrszmidt » 13 Mar 2017, 21:13

Thank you Didi, but i've made it a bit other way. Not so skilled in programimng at all - so a tip from JanStarzak:

- the problem was that i should first convert into clip, add a name to instance of clip, then add Clasic animation. i was doing it in wrong order. Now its working.


Here is a link to compleate template - lower third two lines (f0 and f1) and image from adress (url - can be internet adres like http://) https://www.dropbox.com/sh/m5zact9sskeczj6/AADG7v3cINIbmHfuNm6Dvyu0a?dl=0
User avatar
piotrszmidt
 
Posts: 44
Joined: 27 Mar 2013, 12:29
Location: Warsaw, Poland


Return to Content

Who is online

Users browsing this forum: No registered users and 2 guests