| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Nov 2004
Location: London
Posts: 9
|
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. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2005
Location: India
Posts: 1,021
|
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> ActionScript Code:
__________________
I like such scripting....
Last edited by Sunny13; 07-11-2005 at 09:22 AM.. |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Nov 2004
Location: London
Posts: 9
|
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 |
|
|
|
|
|
#4 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
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.
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2005
Location: India
Posts: 1,021
|
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.. |
|
|
|
|
|
#6 |
|
Registered User
Join Date: Nov 2004
Location: London
Posts: 9
|
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. |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Nov 2005
Posts: 2
|
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();
|
|
|
|
|
|
#8 |
|
Registered User
Join Date: Nov 2005
Posts: 2
|
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();
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|