You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2017/02/19 00:17:46 UTC
[Flex JS] multiple views?
Hi,
This code compile fine but gives a run time error it looks like only view2 exists. I assume an initialView can only have one view?
<?xml version="1.0" encoding="utf-8"?>
<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:js="library://ns.apache.org/flexjs/basic"
applicationComplete="init()">
<fx:Script><![CDATA[
public function init():void {
text1.text = "Visible";
text2.text = "Hidden";
}
]]></fx:Script>
<js:valuesImpl>
<js:SimpleCSSValuesImpl/>
</js:valuesImpl>
<js:initialView>
<js:View id="view1" visible="true" percentWidth="100" percentHeight="100">
<js:Label id="text1" text="View 1" />
</js:View>
<js:View id="view2" visible="false" percentWidth="100" percentHeight="100">
<js:Label id="text2" text="View 2" />
</js:View>
</js:initialView>
</js:Application>
Justin
Re: [Flex JS] multiple views?
Posted by Justin Mclean <ju...@classsoftware.com>.
HI,
> The compiler should, however, report an error when two or more values are
> assigned to a property that doesn't accept it, so please file a bug for
> that.
Raised https://issues.apache.org/jira/browse/FLEX-35273
Thanks,
Justin
Re: [Flex JS] multiple views?
Posted by Alex Harui <ah...@adobe.com>.
On 2/18/17, 11:43 PM, "Harbs" <ha...@gmail.com> wrote:
>I think the idea was to swap out the view in initialView at runtime, but
>multiple children of initialView is not supported.
>
>I don’t know that swapping views was ever tested though.
Like everything else, even Application is PAYG. Most apps I've seen have
a main view that doesn't change. Instead, the contents of the main view
change via States and Navigators. In regular Flex, the main view was the
Application so few folks ever tried to swap it. Changing out initialView
might require additional code in other beads.
The compiler should, however, report an error when two or more values are
assigned to a property that doesn't accept it, so please file a bug for
that.
There is a StackedViewManager in the Mobile swc that MobileTrader uses
similar to how mobile apps had navigators for regular Flex.
HTH,
-Alex
Re: [Flex JS] multiple views?
Posted by Harbs <ha...@gmail.com>.
I think the idea was to swap out the view in initialView at runtime, but multiple children of initialView is not supported.
I don’t know that swapping views was ever tested though.
Harbs
> On Feb 19, 2017, at 2:17 AM, Justin Mclean <ju...@classsoftware.com> wrote:
>
> Hi,
>
> This code compile fine but gives a run time error it looks like only view2 exists. I assume an initialView can only have one view?
>
> <?xml version="1.0" encoding="utf-8"?>
> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> xmlns:js="library://ns.apache.org/flexjs/basic"
> applicationComplete="init()">
>
> <fx:Script><![CDATA[
> public function init():void {
> text1.text = "Visible";
> text2.text = "Hidden";
> }
> ]]></fx:Script>
>
> <js:valuesImpl>
> <js:SimpleCSSValuesImpl/>
> </js:valuesImpl>
>
> <js:initialView>
> <js:View id="view1" visible="true" percentWidth="100" percentHeight="100">
> <js:Label id="text1" text="View 1" />
> </js:View>
> <js:View id="view2" visible="false" percentWidth="100" percentHeight="100">
> <js:Label id="text2" text="View 2" />
> </js:View>
> </js:initialView>
>
> </js:Application>
>
> Justin