开发者

What is <rs: in Flex/Action Script 3?

I found

<rs:Page>
    <mx:Image source="@Embed('image1.jpg')" />
    <mx:Label   x="400" y="40" fontFamily="Verdana" fontSize="9" color="#cccccc" text="butn" />
    <mx:Label   left="100" right="120" y="90"  color="#Ffccdd" textAlign="left" text="Label Text" />
</rs:Page>

In a mxml file. What does that means?

Edit: 1

<?xml version="1.0" encoding="utf-8"?>
<mx:Ap开发者_运维问答plication
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:filters="flash.filters.*"
    xmlns:rs="com.mybooks.book.*"
    layout="absolute" 
    backgroundColor="#333333" 
    creationComplete="onCreationComplete()" 
    viewSourceURL="source/index.html" width="600" height="330">


It means that a custom namespace with the prefix rs is defined. Look for a definition like this at the beginning of the mxml file:

<?xml version="1.0"?>
<mx:Application 
  xmlns:mx="http://www.adobe.com/2006/mxml"
  xmlns:rs="example.package.name.*"
>

see Using XML namespaces

Page is a custom component which defined in the rs namespace.

In plain ActionScript you would write something like this:

import com.mybooks.book.Page;

private function createPage(): void
{
    var page: Page = new Page();
    this.addChild(page);
    var image: Image = new Image();
    // TODO: set image properties 
    page.addChild(image);
    var labelA: Label = new Label();
    // TODO: set labelA properties 
    page.addChild(labelA);
    var labelB: Label = new Label();
    // TODO: set labelB properties 
    page.addChild(labelB);
}


The above answers that mentioned "rs" being a custom namespace are correct, but "<rs:Page>" is specific enough that it can also be identified as part of Ruben Swieringa's Flex book component. When using the component in a Flex project, the "rs" namespace appears as "xmlns:rs="com.rubenswieringa.book.*" by default, due to the package structure of the component. Furthermore, "<rs:Page>" is a child of "<rs:Book>".


xmlns:rs="com.mybooks.book.*"

the <rs: is the namespace
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜