0

我已经彻底清除了我能找到的所有资源,以确定我遇到的问题的解决方案。基本上,我无法重新指定任何按钮的 x 或 y 位置(通过源代码或设计)。如果你们中的任何人可以建议我如何解决这个问题,我将不胜感激。谢谢你。:)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" 
    frameRate="999" 
    creationComplete="init();"
    >
    <mx:Style source="Whistle.css"/>
    <!--local:whistle id="myWhistle"/-->
        <mx:Label text="=" width="13" fontWeight="bold" fontSize="15"/>
        <mx:Text text="{tempo_slider.value}" width="30"/>

    <mx:Button id="stop" icon="@Embed(source='../assets/media-playback-stop.png')"
        click="{if (playPause.selected) {player.stop();playPause.selected=false;}}"/>
    <mx:Button id="playPause" width="40"

               click="{if (playPause.selected) player.play(); else player.pause();}"
               downIcon="@Embed(source='../assets/media-playback-pause.png')" labelPlacement="top"
               overIcon="@Embed(source='../assets/media-playback-start.png')"
               selectedDownIcon="@Embed(source='../assets/media-playback-start.png')"
               selectedOverIcon="@Embed(source='../assets/media-playback-pause.png')"
               selectedUpIcon="@Embed(source='../assets/media-playback-pause.png')" toggle="true"
               upIcon="@Embed(source='../assets/media-playback-start.png')"/>
    <mx:Button id="loop" toggle="true"

        icon="@Embed(source='../assets/view-refresh.png')"
        change="{player.loop=loop.selected;}"/>

    <!--<mx:Label text="midiFileURL={midiFileURL}" />-->

    <mx:Script>
        <![CDATA[
            //[Bindable]
            private var midiFileURL:String;
            import mx.core.FlexGlobals;
            import com.knet.Player;
            private var player:Player;
            private function init():void {
                midiFileURL=FlexGlobals.topLevelApplication.parameters.midiFileURL;
                //midiFileURL="http://www.reveeveille.net/audio/gavotte_yves_menez_0.mid";
                //midiFileURL="../assets/gavotte_yves_menez_0.mid";
                //midiFileURL="../assets/bwv806b.mid";
                //midiFileURL="../assets/gavotte_de_audiern.mid";
                //midiFileURL="../assets/an_alarch.mid";
                //midiFileURL="../assets/Another_Jig_Will_Do.mid";
                midiFileURL="../assets/bro_goz.mid";
                //midiFileURL="../assets/derobee_de_guingamp.mid";
                //midiFileURL="../assets/Evit_Farsal_waltz.mid";
                //midiFileURL="../assets/mtsofmourne.mid";
                //midiFileURL="../assets/andro_traditionnel_09.mid";
                player=new Player(/*myWhistle,*/tempo_slider,  midiFileURL);
            }
        ]]>
    </mx:Script>
    </mx:Application>
4

2 回答 2

0

要么在应用程序标签中使用 layout="absolute",要么将按钮放在画布容器中,然后使用 x,y 属性定位它们。

当您不使用绝对值或使用 HBox VBox 之类的控件时,设置 x,y 值不会执行任何操作。

于 2012-04-20T23:12:51.577 回答
0

如果您没有为应用程序指定布局,则默认为“垂直”。所以在“垂直”布局中,您不能将组件放置在所需位置;要实现这一点,您需要将应用程序布局指定为绝对,这样它就可以工作。

于 2012-04-23T12:50:02.813 回答