【问题标题】:Adobe Flash Builder: visual components aren't displayedAdobe Flash Builder:不显示可视组件
【发布时间】:2014-03-27 23:07:35
【问题描述】:

我卡住了。我一直在尝试使用Adobe Flash Builder 开发简单的应用程序,但没有运气。

这很简单,我什至没有在任何类型的模拟器/设备上显示诸如 button 之类的视觉元素。

我看了一些视频教程,似乎一切都正确,没有出现错误,但问题是当我在 device/simulator/air iOS/Android 甚至是真正的 iOS 设备上启动应用程序时 - 它仍然是空白....为空.只是白屏

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160"
               applicationComplete="init(event)">

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <s:Button id="button1" x="100" y="58" label="300ms"/>   
    <s:Button id="button2" x="200" y="58" label="500ms"/>
    <s:Button id="button3" x="300" y="58" label="1000ms"/>

    <fx:Script>
        <![CDATA[
            import com.adobe.nativeExtensions.Vibration;

            private var vibrate:Vibration

            private function init(evt:Event):void
            {
                trace("We are here");

                if(Vibration.isSupported)
                {
                    setupButtons();
                } else {
                    trace("Vibration is not supported");
                }                           
            }

            private function setupButtons():void
            {
                button1.addEventListener(MouseEvent.CLICK, handleButtons);
                button2.addEventListener(MouseEvent.CLICK, handleButtons);
                button3.addEventListener(MouseEvent.CLICK, handleButtons);

                vibrate = new Vibration();
            }

            private function handleButtons(event:MouseEvent):void
            {
                switch (event.currentTarget.id)
                {
                    case "button1":
                        vibrate.vibrate(300);
                        break;
                    case "button2":
                        vibrate.vibrate(500);
                        break;
                    case "button3":
                        vibrate.vibrate(1000);
                        break;                  
                }

            }
        ]]>
    </fx:Script>    
</s:Application>

至少应该出现 3 个按钮。在控制台中调试时没有有用的信息,在 -init() 方法中没有在断点处停止。

我对我的第一次会议flash builder 和为移动平台进行开发感到非常沮丧。 Flash Builder 4.7

提前致谢

【问题讨论】:

  • 调试时是否收到跟踪消息?可能是一些异常阻止应用程序完成初始化(尝试注释所有初始化代码并仅保留 mxml 并查看是否获得按钮)
  • 不,我没有得到任何调试信息
  • 如果我删除

标签: apache-flex actionscript air adobe flash-builder


【解决方案1】:

我认为是初始化代码崩溃,尝试删除所有行,然后在工作时将脚本行一一添加,直到找到问题为止。

【讨论】:

  • 我正在尝试这样做......只有跟踪线的空 init() 方法工作正常
  • ty,但我不知道我是否应该接受这个答案,因为它本身不是答案。看起来更像评论...
  • @Injectios 我很难找到有问题的行,即使我使用完全相同的代码也不会在这里发生(我可能有不同版本的东西)但答案是init 函数中的错误是正确的,这为您指明了正确的方向,并且在 5 分钟内您可以用有问题的线路回复我,我可以提供更多帮助
  • 这对我来说也是个问题
  • ok,所以空屏是导入震动扩展造成的。但我希望以正确的方式导入它
猜你喜欢
  • 1970-01-01
  • 2012-01-24
  • 2011-01-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-10
  • 1970-01-01
相关资源
最近更新 更多