Question

I'm trying to create JSFL script so I can set hotkeys for different types of blur filters.

I copied the following code out of history. Yet, when this code is used it will use default values: blurX=5, blurY=5. The "Extending Flash" documentation was no help. It just gave me the same code with no explanation on how to modify the values in code. Thanks Adobe! (Sarcasm)

fl.getDenter code hereocumentDOM().addFilter('blurFilter')

Then I did some more searching an found this code:

var currentFilters = fl.getDocumentDOM().getFilters(); for(var i=0; i<currentFilters.length; i++) { if(currentFilters[i].name == "blurFilter") { currentFilters[i].blurX = 10;} } fl.getDocumentDOM().setFilters(currentFilters);

Source: http://www.adobemarketing.com/devnet/flash/articles/jsfl_overview.html

The problem is that when I activate this code with something selected flash does nothing. I did take note that the article was written for "Flash 8," however, there must be some updated version to this.

Is there something I'm missing? Is there another way to use JSFL to add a custom blur effect?

BTW: I have Flash CS6

Any help or clues to help me solve this would be much appreciated. Thanks in advance! -Pat

Was it helpful?

Solution

You should check the Flash CS6 JSFL reference. Note that the see also section mentions document.setFilterProperty(), so something like this should work:

var doc = fl.getDocumentDOM();
doc.addFilter("blurFilter"); 
doc.setFilterProperty("blurX", 0, 10);//assuming the blur above is the 1st filter applied (has index 0)
doc.setFilterProperty("blurY", 0, 10);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top