开发者

Splash screen with FXG in Mobile applications with Flash Builder for PHP

I want to use a .FXG asset on my android application that I am开发者_如何学C building using Flash Builder for PHP.

It gives me an error message saying my assets.MyResource class does not exist.

ïnvalid class name {assets.MyResource} specificied for SplashScreenImage attribute


OK, the primary focus for your solution is the preloader attribute on a mobile application. See the preloader="CustomSplashScreen" below:

<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    firstView="views.FXGSplashHomeView" 
    preloader="CustomSplashScreen"
    splashScreenMinimumDisplayTime="3000"
    applicationDPI="160">
</s:ViewNavigatorApplication>

The CustomSplashScreen extends and overrides the spark.preloaders.SplashScreen class, and the getImageClass function.

package 
{

    import mx.core.DPIClassification;
    import mx.core.mx_internal;

    import spark.preloaders.SplashScreen;

    use namespace mx_internal; 
    public class CustomSplashScreen extends SplashScreen 

    { 
        public function CustomSplashScreen() 
        { 
            super(); 
        } 

        override mx_internal function getImageClass(dpi:Number, aspectRatio:String):Class 
        { 
            return Class(splash);
        } 
    }
}

The splash in the return Class(splash), is a simple fxg file, like so:

<?xml version="1.0" encoding="UTF-8"?>
<Graphic xmlns="http://ns.adobe.com/fxg/2008"
        xmlns:d="http://ns.adobe.com/fxg/2008/dt"
        xmlns:fc="http://ns.adobe.com/flashcatalyst/2009"
        version="2.0">
    <Path y="1" data="M 0 10 L 40 10 L 35 0 L 9 15 L 35 30 L 40 20 L 0 20 z">
        <fill>
            <SolidColor color="#0000FF" alpha="0.6"/>
        </fill>
    </Path>
</Graphic>

That's all there is to it. Have fun!

-- Allen

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜