解决fl.findObjectInDocByType/fl.findObjectInDocByName的毛病
2012-03-12 16:31
239 查看
今天在做一个从Fla导出PNG的东东时,要用到fl.findObjectInDocByType函数,但是一运行自己写的JSFL时,居然说fl.findObjectInDocByType不是一个函数。凭直觉这应该是函数未定义好。果然,在找了半天之后,找到这个文章帮了大忙。大概就是说要手动添加运行代码,使定义fl.findObjectInDocByType的JSFL代码的运行。我是照着最后一个大哥说的做的,就是在自己的JSFL里添加了:
用这一招是最灵的了。
再看一看fl.findObjectInDocByName()函数。帮助文档上说得清清楚楚:
[/code]
虽然说
if( fl.findObjectInDocByType == null ){ fl.runScript( fl.configURI + “Javascript/ObjectFindAndSelect.jsfl” ); }
用这一招是最灵的了。
再看一看fl.findObjectInDocByName()函数。帮助文档上说得清清楚楚:
用法
fl.findObjectInDocByName([code]instanceName, document)
[/code]
参数
instanceName一个字符串,指定在指定文档中某项的所有或部分实例名称。
document要在其中搜索指定项的 Document 对象。
虽然说
instanceName是可以指定在指定文档中某项的所有或部分实例名称,但是经过实验,只能取得实例名称完全匹配的元件,打开
ObjectFindAndSelect.jsfl
文件查找到91行FlashUtils_findObjectInTimelineByName,将108行的if (items[l].name == objName)改为if (items[l].name.match(objName))就可以了。 具体原因当然都很简单了! //////////////////////// 上面说的那篇文章内容如下(怕以后删了找不着):
Bug in JSFL fl.findObjectInDocByType in Flash CS3
March 6th, 2008
Goto comments Leave a comment
New CS3 JSFL library’s are broken which would have been great to have. I tried to use the new finObjectInDocByType and I even used the example provided in the livedocs and it crashes. Maybe this was not implemented for AS3? I hope this gets fixed soon we could do some rad stuff! Adobe use the bug system that you have for Flex for Flash too!
******BUG******
Concise problem statement:
fl.finObjectInDocByType crashes in the example given in live docs.
Steps to reproduce bug:
Create a JSFL script and place it in your commands directory like other jsfl code.
Copy and past the first example from livedocs for finObjectInDocByType
Create a flash as3 fla file and place a text field on the stage.
command -> script name
you will get an error stating: At line 64 of file “ObjectFindAndSelect.jsfl”: TypeError: nextSymbolItemObj has no properties.
ShareThis
Flash Platform, jsfl
Comments (5) Trackbacks (0) Leave a comment Trackback
Vincy
July 18th, 2008 at 07:29 | #1
Reply | Quote
This error can be resolved by following these simple steps:
1) Go to the following location:
C:\Documents and Settings\ocal settings\application data\adobe\flash cs3\en\configuration\javascript (windows xp):
2) Open “ObjectFindAndSelect.jsfl” file.
3) Copy and paste the following code at line number 29:
if (objTimeline == undefined) {
return
}
4) Close flash CS3 and restart again, things should work fine.
Vincy
July 18th, 2008 at 07:41 | #2
Reply | Quote
Just a point I forgot to mention:
Copy the JSFL file which uses “fl.findObjectInDocByType” command to the /Commands directory and then try running the command from the Commands menu.
Rost
March 13th, 2009 at 09:39 | #3
Reply | Quote
Vincy, your tips are brilliant. Helped me to fix my “fr.Find in Flash” Search panel completely.
I’d add a bit to your second comment:
It seems the “ObjectFindAndSelect.jsfl” file is executed automatically each time you run your JSFL code from the Commands menu.
But, if you run, for example, a JSFL file from your Flash Panel, the “ObjectFindAndSelect.jsfl” is not run automatically, so its functions like fl.findObjectInDocByType won’t be visible from your code.
To workaround this, just run the needed file before running your code:
fl.runScript( fl.configURI + \”WindowSWF/fr.findTextFromPanel.jsfl\
And its functions will start working for your flashpanel.
Thanks,
Rost
David Goodman
August 19th, 2009 at 09:54 | #4
Reply | Quote
I was wondering Rost, could you give me an example of how to fix the ObjectFindAndSelect.jsfl problem from the WindowSWF I am stuck on this and I’m unable to work out what to do from your comment.
My AS3 class that is linked up to the WindowSWF calls on a button click
MMExecute(“fl.runScript(fl.configURI + ‘Javascript/ObjectFindAndSelect.jsfl’);”)
MMExecute(“fl.runScript(‘file:///C|/svn/Flash/jsfl/brandLanguageConfigTools.jsfl’, ‘skinFile’,\”" + strToPass + “\”,\”" + cbFLA.selectedItem.label + “\”);”);
The 2nd MME has the fl.findByName call which causes the error, I also put the fl.runScript(ObjectFindAndSelect.jsfl) call inside the functions of that JSFL hoping that would get it working but no cookie :( any help?
thanks
slopps
June 3rd, 2011 at 10:20 | #5
Reply | Quote
Also, simply adding this code before you call findObjectInDocByType will fix it:
if( fl.findObjectInDocByType == null ){ fl.runScript( fl.configURI + “Javascript/ObjectFindAndSelect.jsfl” ); }
I found that in a comment for the CS4 livedocs.
相关文章推荐
- Spark 2.0 DataFrame map操作中Unable to find encoder for type stored in a Dataset.问题的分析与解决
- Spark 2.0 DataFrame map操作中Unable to find encoder for type stored in a Dataset.问题的分析与解决
- AIR 14 Beta - Missing builtin type Object 解决方法
- 解决 Error:Unable to find encoder for type stored in a Dataset
- How do I get the name of an object's type in JavaScript
- “object name conflicts in archive”的解决办法
- Ubuntu 编译opencv出错:‘GstMiniObjectClass’ does not name a type 解决方法
- Eclipse中使用printf报错 提示参数类型不对 已解决The method printf(String, Object[]) in the type PrintStream is not ap
- 'Could not find first log file name in binary log index file'的解决办法
- arduino写自定义库文件报错解决not name of type、not declared in this scope
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- The type or namespace name 'Zhaopin' does not exist in the namespace 'LMSoft' 问题的解决
- Spark 2.0 DataFrame map操作中Unable to find encoder for type stored in a Dataset问题的分析与解决
- 解决The type or namespace name \'XXXX\' does not exist in the namespace \'XXXXXXXXX\' 的错误
- ID为GUID类型时使用ObjectDataSource控件的时候的未找到DataObjectTypeName属性的解决方法
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- 如何解决Selenium中"Cannot find function addEventListener in object [object HTMLDocument]"的错误
- 错误解决:Cannot find bean: "beanName" in scope: "request"
- [EntLib]解决The type or namespace name 'Data' does not exist in the namespace 'Microsoft.Practices.EnterpriseLibrary' 的错误