今天试图重新改变现有的CSS Framework,放弃之前自定义的CSSLoader,采用运行时加载CSS的方式。
不过目前还是做尝试,需分析两种方式所能处理的各种情况,找出需要处理的特殊情况,然后分析是否值得更改。
采用运行时加载CSS的方式
需将CSS文件预编译成SWF文件,看了网上提供的方式,发现直接在Flex Builder中compile,找不到生成的SWF文件。。也不是很了解其中的机制,于是采用另外一种方式,切换到Flex Builder的安装目录,找到SDK下的bin目录mxmlc.exe,执行,输入命令mxmlc path/test.css,然后在path下会生成相应的test.swf。
不过在编译的时候出现错误:
Invalid Embed directive in stylesheet - can't resolve source 'Embed("/assets/test.png")'
搜索了半天发现中文只有少量帖子关于这个问题,但是并没有解决方案,于是切换搜英文的,果然发现很多相关帖子,简而言之根本原因就是Embed中提供的路径有问题,编译时无法根据给出的路径找到相应的文件。
下面贴出解决方案以及一些有用的回复,我就懒得翻译了,反正大部分人都能看懂英文:
写道
Invalid Embed directive in stylesheet
On a few occasions now, for no really apparent reason, suddenly our Problem Pane will be spammed with tons of messages all sort of looking like this:
Invalid Embed directive in stylesheet - can't resolve source 'Embed(source = "/assets/common.swf", symbol = "AccordionHeader_disabledOverSkin")'.
In the past, sometimes it would only happen on a mac, other times windows machines. I've tried deleting my bin folder, cleaning the project, recompiling the swf's, moving the swf's around, changing the syntax in the css ever so slightly. I've googled this on many occasions and found no clear answer. Today I decided that I needed to know what caused this and if in fact I figured it out, to share it with you.
What ended up being the root cause of our problem is that in several places in the application we were referencing image assets directly in our assets folder, i.e. /assets/delete.png, which is often the case when our designers aren't keeping up with asset creation and developers just throw some image up as a placeholder for the time being. Now it just so happened that ONE of these references was incorrect and its Embed pointed to a file that did not exist. I discovered this when I commented out our style css references in the application, and saw the error only then. It was this broken reference that caused the above error. I fixed the reference to point to the right file, did a Project clean, and all the Invalid Embed Directive errors went away.
I should note that we had over 100 references to symbols in our css, and by default Flexbuilder only shows the first 100 errors. Unluckily the "unable to resolve 'assets/deleted.png' for transcoding in ...." was error number 138 and did not show up in the list. I had to change my preferences to show all 138 errors.
So the lesson learned is that when you get spammed with this error, it could well be that only one Embed tag somewhere in your app is actually broken, and that your css and swf is probably just fine.
符合我的情况的回复:
写道
Just thought I'd add that I've run into this error in the past specifically when compiling with the command line compiler or with flex ant tasks. I was experiencing an issue where FB's built in compiler would compile without errors, but the command line/ant compilers would return with the "Invalid Embed" errors. It turned out that for some reason the command/ant compilers were having difficulty resoloving abosolute paths such as '/assets/images/myImage.png'. I was able to resolve the errors by changing the absolute path references to relative path references such as '../../../assets/images/myImage.png' in files that were reporting errors.
分享到:
相关推荐
在ROS(Robot Operating System)开发过程中,遇到`rlexception: invalid roslaunch xml syntax: no element found: line 1, column 0`这样的错误信息时,表明当前的`.launch`文件存在XML语法错误。具体来说,可能是...
NULL 博文链接:https://wilian.iteye.com/blog/1992365
再和前台对接的时候一直报错:invalid url domain 在网上查找了很多资料,有说端口的问题,也有其它各种原因的,一大堆,最后我发现以上的说法都不准确,这是我配置的地址(错误的地址) 把配置地址的http://去掉...
在XML Schema设计中,"cvc-complex-type.2.4.d: Invalid content was found" 是一个常见的错误信息,这通常意味着在解析XML文档时,遇到了不符合定义的复杂类型的内容。这个错误通常涉及到XML Schema的约束规则,即...
在压缩包中的"Flex错误编号.xls"文件中,你可以找到更多关于Flex编译错误的详细信息,包括错误编号、错误描述和解决方案。通过查阅这份资料,开发者可以更好地理解Flex开发中的常见问题,并提高问题解决的效率。在...
在Python开发过程中,遇到"error: invalid command ‘egg-info‘"这样的报错通常是由于安装或配置Setuptools库时出现了问题。Setuptools是Python项目构建、安装和管理的工具,而`egg-info`命令用于生成项目的元数据...
所以,为了解决“nc: invalid option — ‘e’”错误,我们需要将 `/etc/alternatives/nc` 文件符号链接指向 `/bin/nc.openbsd` 文件,而不是 `/bin/nc.traditional` 文件。可以使用以下命令来实现: `sudo rm /etc...
Generic syntax highlighter syntaxerror: invalid syntax syntaxerror: invalid syntax syntaxerror: invalid syntax syntaxerror: invalid syntax syntaxerror: invalid syntax
syntaxerror: invalid syntax syntaxerror: invalid syntax syntaxerror: invalid syntax syntaxerror: invalid syntax syntaxerror: invalid syntax
### Nginx常见错误及其解决方法 #### 一、启动错误:`sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory` **问题描述**: 在尝试启动...
AssertionError: Invalid device id 仔细检查后发现原来服务器有多个GPU,当时开启了两个进行加速运算。 net1 = nn.DataParallel(net1, device_ids=[0, 1]) 而本地台式机只有一个GPU,调用数量超出所以报错。 改为 ...
python——pip install xxx报错SyntaxError: invalid syntax 在安装好python后,进入python运行环境后,因为我要用pip安装开发Web App需要的第三方库,执行pip install aiohttp,发现会报错SyntaxError: invalid ...
在C++编程中,`std::invalid_argument` 是一个异常类,用于表示当函数或方法接收到不合法或无效的参数时抛出的错误。这个类是`std::logic_error` 的子类,而`std::logic_error` 又是`std::exception` 的子类。`std::...
Invalid Multibyte Character Sequence 警告解析 在编程中,特别是在嵌入式系统开发中,我们经常会遇到Invalid Multibyte Character Sequence 警告。这个警告通常来自于编译器,告知我们存在非法的多字节字符序列。...
Java反编译工具是开发人员在处理Java字节码时常用的一种工具,它能够将已编译的.class文件转换回可读的Java源代码。这对于理解已加密或混淆的代码、学习第三方库的工作原理或者进行逆向工程时非常有用。在Java领域,...
解决ZipArchive::getFromName(): Invalid or uninitialized Zip object报错问题
NULL 博文链接:https://ruyuntao.iteye.com/blog/267105
QuartusII 是一个功能强大且复杂的 FPGA 设计工具,但是它也存在一些常见的错误,这些错误通常是由于 License 错误、软件版本问题、设计文件错误等所引起的。下面我们将对这些常见错误进行总结和解决方法的介绍。 1...