必须是一个简单的错误,我做:Flex CSS样式不工作在trival的情况下 [英] Must be a simple mistake I'm making: Flex CSS style not working in a trival case

查看:237
本文介绍了必须是一个简单的错误,我做:Flex CSS样式不工作在trival的情况下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须做一个简单的错误(新的Flex)。这里是main.mxml:

I must be making a simple mistake (new to Flex). Here is main.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
                backgroundColor="#ff0000">
    <mx:Style source="/testing123.css"/>
    <mx:Canvas top="0" bottom="0" left="0" right="0" styleName="bg-lowlight" >
    </mx:Canvas>
</mx:Application>

这里是testing123.css:

and here is testing123.css:

.bg-lowlight

    {
        backgroundColor: #003366;
    }

画布在设计模式下呈现良好运行应用程序(在浏览器中或在Flash Player中)框架是红色的(应用程序标记的颜色)。如果我直接指定Canvas的颜色,而不是通过styleName,它会按预期工作(在运行时是蓝色画布)。

The Canvas renders fine in design mode (a nice deep blue) but when I run the application (either in the browser or in the Flash Player) the frame is red (the color from the Application tag). If I specify the color for the Canvas directly, instead of through the styleName, it works as expected (blue canvas at runtime).

我使用FlexBuilder3,

I'm using FlexBuilder3, and would much rather put colors in a .css file than on every Flex element!

帮助!!!

*。 **附加的问题描述...与外部.css文件无关。即使我在main.xml文件中声明CSS样式,它在设计模式下仍然看起来很好,运行时却是错误的。我完全停止了。

*** Additional problem description ... has nothing to do with an external .css file. Even if I declare the CSS styles within the main.xml file, it still looks fine in Design mode and wrong when it runs. I am completely stymied.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#ff0000">
    <mx:Style > 
.bg-lowlight
{
    backgroundColor: #003366;
}
    </mx:Style>
    <mx:Canvas top="0" bottom="0" left="0" right="0" styleName="bg-lowlight" id="canvas1">
    </mx:Canvas>
</mx:Application>


推荐答案

所以...用CookieOfFortune的帮助我跟踪了问题根源:

So...with CookieOfFortune's help I tracked down the root of the problem:


  • CSS类名称( bg-lowlight )无效。 ' - '不允许

  • the CSS class name (bg-lowlight) was invalid. The '-' is not allowed

这是发生什么,我猜,当你猜到什么是逻辑!

that's what happens, I guess, when you guess at what is logical!

这篇关于必须是一个简单的错误,我做:Flex CSS样式不工作在trival的情况下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆