Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Extensions and Plugins > JSFL - Extending Flash

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-05-2005, 03:36 PM   #1
Kuma
Registered User
 
Kuma's Avatar
 
Join Date: Nov 2004
Location: London
Posts: 9
Default Select color and Delete?

Hi,

Is there a way that through JSFL I can select a colour and then delete it?

I know that the Find and Replace (F3) has the ability to find and replace colours, but can this can't delete.

I have looked throught he Fill object but I couldn't see a select colour method.


Thanks.
Kuma is offline   Reply With Quote
Old 07-06-2005, 10:39 AM   #2
Sunny13
Senior Member
 
Sunny13's Avatar
 
Join Date: Jul 2005
Location: India
Posts: 1,021
Default try xml in jsfl to select color

Code:
<dialog id="ColorTest" title="Colour Picker" buttons="accept, cancel"><grid> <columns>  <column/>  <column/> </columns> <rows>  <row>    <label value="Colour:" control="colpick" />      <colorpicker>       <colorchip id="colpick" color="#FF0000" />      </colorpicker>  </row> </rows></grid></dialog>
open the above xml in the following jsfl file as:-

ActionScript Code:
var xui = fl.getDocumentDOM().xmlPanel(fl.configURI + "Commands/color.xml");if (xui) {  var myColour = fl.trace("Colour: " + xui.colpick);}
__________________
I like such scripting....

Last edited by Sunny13; 07-11-2005 at 09:22 AM..
Sunny13 is offline   Reply With Quote
Old 07-08-2005, 07:05 PM   #3
Kuma
Registered User
 
Kuma's Avatar
 
Join Date: Nov 2004
Location: London
Posts: 9
Default

Hi,

Thanks for the reply,

I have created the JSFL and the XML as you suggest.
But the above code only traces the colour value.

How can I get it to select every 'instance' of that colour in the frame?


Thanks
Kuma is offline   Reply With Quote
Old 07-09-2005, 06:03 PM   #4
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

you will have to loop through all the elements on that frame and check what type it is, if it is a shape/fill see if you can get the color. i don't know if what you want is possible, but i suspect it is.
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 07-11-2005, 06:09 AM   #5
Sunny13
Senior Member
 
Sunny13's Avatar
 
Join Date: Jul 2005
Location: India
Posts: 1,021
Default Explain!!

Hi,
could you plz explain your problem a bit more????....hope i can help you
__________________
I like such scripting....

Last edited by Sunny13; 07-11-2005 at 09:23 AM..
Sunny13 is offline   Reply With Quote
Old 07-17-2005, 11:08 PM   #6
Kuma
Registered User
 
Kuma's Avatar
 
Join Date: Nov 2004
Location: London
Posts: 9
Default

ok,

I want to run a JSFL command where I can select a colour in a frame.
I then want to delete the instances of that colour.

An example;

If I import an black and white drawing from Illustrator there may be hundreds of white fills which are actually not meant to be there.

It can be a royal pain to select all of these by hand, so a JSFL to do it for me would be cool.
Kuma is offline   Reply With Quote
Old 11-09-2005, 10:19 PM   #7
MikkoH
Registered User
 
Join Date: Nov 2005
Posts: 2
Default

Well I've been wanting a similar script as this...
It works great right now if the shapes arent too complicated... I'm trying to make it better...

Heres what I do... I basically select everything... The get the selected shape...

Then get the vertices of the shape...
Go through and select nothing then select one of the vertices... IF the colour is the colour you want then delete the shape... but the only problem is that it will go through all the vertices which can be many many points...

Code:
var trace=fl.trace;
var doc=fl.getDocumentDOM();
var xui = fl.getDocumentDOM().xmlPanel(fl.configURI + "Commands/color.xml");
var vertices=new Array();
var count=0;


fl.outputPanel.clear(); 


if (xui) 
{  
	var myColour = trace("Colour: " + xui.colpick);
}

doc.selectAll();


for(var r=0;r<doc.selection[0].vertices.length;r++)
{
	
	vertices[count]=doc.selection[0].vertices[r];
	count++;
}

trace(vertices.length);

for(var r=0;r<vertices.length;r++)
{
	doc.selectNone();
	doc.mouseClick({x:vertices[r].x, y:vertices[r].y}, false, false);

	var fill = doc.getCustomFill();
	
	if(fill.color=="'"+xui.colpick.toLowerCase()+"'")
	{
		doc.deleteSelection();
	}
}

doc.selectNone();
MikkoH is offline   Reply With Quote
Old 11-09-2005, 10:25 PM   #8
MikkoH
Registered User
 
Join Date: Nov 2005
Posts: 2
Default

Made it a bit better... But really not a substantial difference...

Code:
var trace=fl.trace;
var doc=fl.getDocumentDOM();
var xui = fl.getDocumentDOM().xmlPanel(fl.configURI + "Commands/color.xml");


fl.outputPanel.clear(); 


if (xui) 
{  
	var myColour = trace("Colour: " + xui.colpick);
}

doc.selectAll();
vertices=doc.selection[0].vertices;

for(var r=0;r<vertices.length;r++)
{	
	doc.selectNone();
	doc.mouseClick({x:vertices[r].x, y:vertices[r].y}, false, false);

	var fill = doc.getCustomFill();
	
	if(fill.color=="'"+xui.colpick.toLowerCase()+"'")
	{
		doc.deleteSelection();
	}
}


doc.selectNone();
MikkoH is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:05 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.