Skip to main content
Inspiring
October 11, 2007
Question

fill color in movieclip

  • October 11, 2007
  • 5 replies
  • 532 views
with (myClip) {
moveTo(0,0);
lineTo(50,0);
lineTo(50,100);
lineTo(0,100);
lineTo(0,0);
}

this creates shape which is empty .
I want to fill the shape created after i have set a certain parameter to
true. How to do that with movieclip.
beginFill not usable since it starts filling just from begining.



This topic has been closed for replies.

5 replies

Inspiring
October 19, 2007
Can you send the fla somewhere.


"clbeech" <webforumsuser@macromedia.com> wrote in message
news:ff7qj5$pe3$1@forums.macromedia.com...
> hmmm .... it seems to work fine for me in testing, and only fills the MC
> regardless of it's position on Stage. What's not working for you?


clbeech
Inspiring
October 18, 2007
hmmm .... it seems to work fine for me in testing, and only fills the MC regardless of it's position on Stage. What's not working for you?
Inspiring
October 15, 2007
Can u send the exact code please.


"clbeech" <webforumsuser@macromedia.com> wrote in message
news:feo5eq$525$1@forums.macromedia.com...
> Sorry, man, you must have grabbed that code before I'd made my edit, and
> I'm
> afraid I'd 'winged' it on the spot. But then though 'hey I outta test
> that',
> then realized there were some better ways to orgainize it. Take another
> look
> at the code block above, I'd changed several elements.
>
> In this system, I decided that it would be better to draw directly into
> the
> clip that is being called, and should solve the placement issue, attaching
> the
> bmp directly to it.
>
> Additionally, instead of calling '_root' try: '_level0.mc[ ... ]' I
> assume
> then that you have a 'parent' container named 'mc' that 'myClip' is drawn
> in.
> Using the access operator should work here as a parameter. But I think I
> would
> put the function itself on the main timeline, and make calls to the
> function
> from a depth as in:
>
> _level0.fillColor(_level0.mc[ ... ], 0xFFFF0000);
>
> also don't forget the 32bit ARGB format.
>


clbeech
Inspiring
October 15, 2007
OK, here's the code again with variable names as you have, although I don't believe you should use 'x' as the numeric value, since it is an Object keyword property, it still seems to function just fine. If '_root.mc['subMc'+x]' was coming to undefined, it may be that you were calling the function previous to the instance being instatiated on the timeline. make sure you call the 'fillColor' function after the MC has been drawn.
clbeech
Inspiring
October 12, 2007
Sorry, man, you must have grabbed that code before I'd made my edit, and I'm afraid I'd 'winged' it on the spot. But then though 'hey I outta test that', then realized there were some better ways to orgainize it. Take another look at the code block above, I'd changed several elements.

In this system, I decided that it would be better to draw directly into the clip that is being called, and should solve the placement issue, attaching the bmp directly to it.

Additionally, instead of calling '_root' try: '_level0.mc[ ... ]' I assume then that you have a 'parent' container named 'mc' that 'myClip' is drawn in. Using the access operator should work here as a parameter. But I think I would put the function itself on the main timeline, and make calls to the function from a depth as in:

_level0.fillClip(_level0.mc[ ... ], 0xFFFF0000);

also don't forget the 32bit ARGB format.
Inspiring
October 11, 2007
>>beginFill not usable since it starts filling just from begining.

Have you tried it and it's not working for you? beginFill is really the only
way to fill a shape with the drawing API. Is it that you're wanting to draw
a shape on screen and only show its outline - and at some later point fill
it? If so, you'd just need to run the same code over, this time turning on
fill... You might change your supplied code to something like this:


with (myClip) {
if(doFill){
beginFill(0xFF0000);
}
moveTo(0,0);
lineTo(50,0);
lineTo(50,100);
lineTo(0,100);
lineTo(0,0);
if(doFill){
endFill();
}
}

--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


clbeech
Inspiring
October 11, 2007
Here's another thought (crazy though!!!) you could create a BitmapData object to perform the fill. when the condition is triggered try this function, and pass in the instance, and the hex color choice, as in:

fillClip(myClip, 0xFF0000);

EDIT: ok, my bad, I forgot a couple of things here, and am changing the code. mainly the 'fill color' value must be a 32 bit ARGB format, as in: 0xFFFF0000. and don't forget to import the BitmapData class, I'm just gonna throw the whole test in there :)