|
|
|
[
Permlink
| « Hide
]
David Gofman - [10/07/07 03:11 AM ]
Same issue in Flex 3
The project root directory is only implicitly added to the source path when compiling style.css in the project root directory. When you move style.css to the assets folder, the project root directory is no longer in the source path, which explains why MyRectangularBorder could not be found. Adding the project root directory to the source path won't work, though, because then style.css will be under two directories in the source path.
One solution is to create a src directory and move com/adobe/skins under the src directory. Then add src and images to the source path. Then remove the "/images" prefix from the Embed. Finally compile style.css like this: mxmlc -source-path=src,images assets/style.css Same problem when I try to compile embed images:
MXML: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Style source="assets/style.css"/> <mx:Image initialize="{event.target.source=event.target.getStyle('helpIcon')}" styleName="imageStyle"/> <mx:TextInput styleName="textStyle"/> </mx:Application> SRC/RoundedBorderSkin: package src { import mx.skins.RectangularBorder; public class RoundedBorderSkin extends RectangularBorder { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); drawRoundRect(0, 0, unscaledWidth, unscaledHeight, {tl:5, tr:5, bl:5, br:5}, 0xff0000, 1); } } } CSS/style.css: .imageStyle{ helpIcon: Embed(source="images/help.swf"); } .textStyle{ borderSkin: ClassReference("src.RoundedBorderSkin"); } mxmlc" -source-path=src,images assets/style.css Loading configuration file C:\eclipse\Adobe_Flex_Builder_2_Plugin\Flex SDK 2\frameworks\flex-config.xml C:\eclipse\workspace\testLib\assets\style.css(2): Error: Invalid Embed directive in stylesheet - can't resolve source 'Embed(source = "images/help.swf")'. helpIcon: Embed(source="images/help.swf"); No luck if I try to compile RoundedBorderSkin class too:
mxmlc -source-path=src,images assets/style.css Loading configuration file C:\eclipse\Adobe_Flex_Builder_2_Plugin\Flex SDK 2\frameworks\flex-config.xml C:\eclipse\workspace\testLib\assets\style.css(5): Error: Access of undefined property RoundedBorderSkin. borderSkin: ClassReference("src.RoundedBorderSkin"); C:\eclipse\workspace\testLib\assets\style.css(5): Error: Definition src:RoundedBorderSkin could not be found. borderSkin: ClassReference("src.RoundedBorderSkin"); Using compiler 3.0, getting same errors
mxmlc -source-path=src,images assets/style.css Loading configuration file C:\eclipse\Flex Builder 3 Plug-in\sdks\3.0.0\frameworks\flex-config.xml This beta will expire on Thu Jan 31 00:00:00 PST 2008. C:\eclipse\workspace\testLib\assets\style.css(2): Error: Invalid Embed directive in stylesheet - can't resolve source 'Embed(source = "images/help.swf")'. helpIcon: Embed(source="images/help.swf"); \mxmlc -source-path=src,images assets/style.css Loading configuration file C:\eclipse\Flex Builder 3 Plug-in\sdks\3.0.0\frameworks\flex-config.xml This beta will expire on Thu Jan 31 00:00:00 PST 2008. C:\eclipse\workspace\testLib\assets\style.css(5): Error: Access of undefined property RoundedBorderSkin. borderSkin: ClassReference("src.RoundedBorderSkin"); C:\eclipse\workspace\testLib\assets\style.css(5): Error: Definition src:RoundedBorderSkin could not be found. borderSkin: ClassReference("src.RoundedBorderSkin"); It works when i tried suggestion from Paul, here is what i did:
I created one more src folder and moved RoundedBorderSkin.as under the new src folder. I added the following to the compiler options -source-path=src,images So my project structure now looks like: Root Folder | Assets | styles.css | Images | help.swf | src | src | RoundedBorderSkin.as | testLib.mxml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||