Results 1 to 3 of 3

Thread: Need some help with ActionSript - Please

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Need some help with ActionSript - Please

    Hi.

    I have this ActionScript which has an entry for an image preloader of which I would like to change the color.

    Code:
    function onLoadProgress (target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
        	    	
        	var arc = -Math.round(100-percent)*3.6;		
    		
        	//draw arc
        	var percent = (bytesLoaded/bytesTotal)*100;    	    	
        	mImgLoadStatus_mc.clear();	
    		var arc = percent*3.6;
    		var arc = -Math.round(100-percent)*3.6;
    		mImgLoadStatus_mc.beginFill(mXMLManager.frameColor,100);
    		DrawUtil.wedge(mImgLoadStatus_mc,mWidth/2, mHeight/2,90,-arc, 40);
    		mImgLoadStatus_mc.endFill();	
        	
    	}
    I understand that this is the code which specifies the preloader color but I'm not sure:

    Code:
    frameColor,100);
    How do I get a color scale to change the value for yellow for example?

    I guess that 100 is black but that's just a guess.

    Any help is greatly appreciated.
    Cheng

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    You're right about the code that controls the color but wrong about the parameter. The MovieClip.beginFill method takes two parameters: the color's RGB value and an alpha value (for opacity).

    Code:
    public beginFill(rgb:Number, [alpha:Number]) : Void
    The 100 means that the fill is at 100% alpha trasparency (i.e. opaque). The color is actually the mXMLManager.frameColor portion. That refers to a property of the mXMLManger object. This isn't a native Flash class so it must be some custom code that you're running.

    If you can't figure out how to change the color, you could try to contact the original author. Or, you could probably just hardcode it before the call you're making.

    Code:
    mXMLManger.framecolor = 0xEE0000;
    mImgLoadStatus_mc.beginFill(mXMLManager.frameColor,100);

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Hi Medyman.

    Thanks for the reply and the explanation.

    I'll give it a try as you suggested here:

    Code:
    mXMLManger.framecolor = 0xEE0000;
    mImgLoadStatus_mc.beginFill(mXMLManager.frameColor,100);
    Hopefully this will work out.

    Thanks again very much,
    Cheng

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •