1180:调用可能未定义的方法TextFormat

时间:2018-02-10 10:20:28

标签: android actionscript-3 air

我开发AIR android.I使用Animate CC。

我在文库中嵌入了Tw Cen MT字体作为Font2。然后导出actionscript 3类名“Font2”,但是当我尝试发布时,我得到了这个错误。 我不知道为什么没有找到TextFormat。

提前感谢您提供任何帮助。

开始main.as

    package  {

import tsiko;
import com.pozirk.ads.admob.AdMob;
import com.pozirk.ads.admob.AdParams;
import com.pozirk.ads.admob.AdEvent;
import com.distriqt.extension.applicationrater.ApplicationRater;
import com.distriqt.extension.applicationrater.events.ApplicationIDEvent;
import com.distriqt.extension.applicationrater.events.ApplicationRaterEvent;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest
import flash.display.Loader;
import flash.display.Sprite
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.desktop.NativeApplication;
import flash.display.StageAlign;
import flash.display.StageScaleMode;


import fl.controls.NumericStepper;
import flash.system.Capabilities;
import flash.text.TextField;
import air.net.*;
import air.net.URLMonitor;
import flash.events.StatusEvent;

public class Main extends MovieClip {
private var _bannerAdUID:String = "ca-app-pub-35669784122226622/378877603936";//Bunu kullanmıyoruz
private var _intersAdUID:String = "ca-app-pub-35669784122226622/3763603936";
public static var APP_KEY : String = "cfe92a192ace6ee5b311ef4595adwdawda1789d919465AqrYxSx1xJuECkfidbNpXmyBhb7hyUh2/hY71gNTMhF/bawd48ad48a4f5a4fwa7i+FvMTex0CrTDjeVI/0rElstcM+s0biL1+yKuNEyujGvqejIAnyuTiWPFtaYUW+M3IvqIfZzg1Gopd2KtS1xeoUj1f6UGFle5ecMYuecbHOhQEmGCj3r6EhfG1eZrBRv8z+vnGaSlrA5CIBb/uggtvTaqSvpPZCYYgD+pw+W01Mc0Z9RBXZeBH0g4mfq8L/1qrEtgRjW6vKWFRzf5CnedOZG47rENJYZYuV5LSULlZ5CZJDwxGcRERn/Wvg9p18sK/U44KXxob4MeQEUvXA+ufPdg==";
protected var _banner:AdMob = new AdMob();
protected var _inters:AdMob = new AdMob();
private var _initOK:Boolean = false;
private var _isShow:Boolean = false;
private var _cacheOK:Boolean = false;   
protected  var monitor:URLMonitor;//ınternet    
private var _text       : TextField;//Oylama

    public function Main() {
        // constructor code
        //btBanner.addEventListener(MouseEvent.CLICK, showBanner);
        //btInters.addEventListener(MouseEvent.CLICK, showInterstitial);
         stage.addEventListener(Event.ENTER_FRAME,reklamdoksan)



_banner.init();
_banner.addEventListener(AdEvent.INIT_OK, onInitEvent);
_banner.addEventListener(AdEvent.INIT_FAIL, onEvent);
_banner.addEventListener(AdEvent.BANNER_SHOW_OK, onEvent);
_banner.addEventListener(AdEvent.BANNER_SHOW_FAIL, onEvent);
_banner.addEventListener(AdEvent.BANNER_LEFT_APP, onEvent);
_banner.addEventListener(AdEvent.BANNER_OPENED, onEvent);
_banner.addEventListener(AdEvent.BANNER_CLOSED, onEvent);

_inters.init();
_inters.addEventListener(AdEvent.INIT_OK, onInitEvent);
_inters.addEventListener(AdEvent.INIT_FAIL, onEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_SHOW_OK, onEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_SHOW_FAIL, onEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onCacheEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_CACHE_FAIL, onEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_LEFT_APP, onEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_OPENED, onEvent);
_inters.addEventListener(AdEvent.INTERSTITIAL_CLOSED, onCloseIntersEvent);

_inters.cacheInterstitial(_intersAdUID);

        monitor = new URLMonitor(new URLRequest('http://www.google.com'));
        monitor.addEventListener(StatusEvent.STATUS, announceStatus);
        monitor.start();



        //Oylama RATER


        super();
        stage.align = StageAlign.TOP_LEFT;
        stage.scaleMode = StageScaleMode.NO_SCALE;

像这样的文字电话

_text = new TextField();
            _text.defaultTextFormat = new TextFormat( "Font2", 18 );
            addChild( _text );      

main.as中的其他代码

if (stage)  addedToStageHandler(null);
            else        stage.addEventListener( Event.RESIZE, addedToStageHandler, false, 0, true );
            stage.addEventListener( MouseEvent.CLICK, mouseClickHandler, false, 0, true );
            stage.addEventListener(Event.ENTER_FRAME,tiki)
            init();
        }











        private function init( ):void
        {
            try
            {
                ApplicationRater.init( APP_KEY );

                message( "ApplicationRater Supported: "+ ApplicationRater.isSupported );

                if (ApplicationRater.isSupported)
                {
                    message( "ApplicationRater Version: " + ApplicationRater.service.version );
                    message( "ApplicationRater State:   " + ApplicationRater.service.state );
                    message( "ApplicationRater Store:   " + ApplicationRater.service.getInstallerStore() );

                    ApplicationRater.service.reset();

                    //
                    //  Setup the app rater service, listeners and register the app launch
                    //
                    ApplicationRater.service.setLaunchesUntilPrompt( 2 );
                    ApplicationRater.service.setSignificantEventsUntilPrompt( 5 );

                    ApplicationRater.service.addEventListener( ApplicationRaterEvent.DIALOG_DISPLAYED, applicationRater_dialogDisplayedHandler );
                    ApplicationRater.service.addEventListener( ApplicationRaterEvent.DIALOG_CANCELLED, applicationRater_dialogCancelledHandler );
                    ApplicationRater.service.addEventListener( ApplicationRaterEvent.SELECTED_RATE, applicationRater_selectedRateHandler );
                    ApplicationRater.service.addEventListener( ApplicationRaterEvent.SELECTED_LATER, applicationRater_selectedLaterHandler );
                    ApplicationRater.service.addEventListener( ApplicationRaterEvent.SELECTED_DECLINE, applicationRater_selectedDeclineHandler );
                    ApplicationRater.service.addEventListener( ApplicationIDEvent.RETRIEVED, applicationId_retrievedHandler );
                    ApplicationRater.service.addEventListener( ApplicationIDEvent.ERROR, applicationId_errorHandler );

                    ApplicationRater.service.setApplicationId( "air.com.takoms.pirutru", ApplicationRater.IMPLEMENTATION_ANDROID );
                    ApplicationRater.service.setApplicationId( "662053009", ApplicationRater.IMPLEMENTATION_IOS );
                    ApplicationRater.service.retrieveApplicationId();

                    ApplicationRater.service.debugMode = true;
                    ApplicationRater.service.applicationLaunched();
                }
            }
            catch (e:Error)
            {
                message( "ERROR::"+e.message );
            }
        }








    private function message( str:String ):void
            {
                trace( str );
                _text.appendText(str+"\n");
            }


        //
        //  EVENT HANDLERS
        //

        private function addedToStageHandler( event:Event ):void
        {
            _text.width  = stage.stageWidth;
            _text.height = stage.stageHeight - 100;
        }



    private function tiki(E:Event):void{

        if (ApplicationRater.service.review.isSupported && tsiko.oylamagelsin==true)
    {
        ApplicationRater.service.review.requestReview();
        tsiko.oylamagelsin=false;
    }



        }       






            private function mouseClickHandler( event:MouseEvent ):void
            {
                //
                //  Do something when user clicks screen?
                //  
                try
                {
                    ApplicationRater.service.userDidSignificantEvent();
                }
                catch (e:Error)
                {
                    message( "ERROR::"+e.message );
                }

    //          try
    //          {
    //              if (ApplicationRater.service.review.isSupported)
    //              {
    //                  message( "Requesting Review" );
    //                  ApplicationRater.service.review.requestReview();
    //              }
    //              else
    //              {
    //                  message( "Review not supported" );
    //              }
    //          }
    //          catch (e:Error)
    //          {
    //              message( "ERROR::"+e.message );
    //          }


                //
                //  Request rating
                ApplicationRater.service.rate();


            }



            //
            //  APPLICATION RATER NOTIFICATION HANDLERS
            //

            private function applicationRater_dialogDisplayedHandler( event:ApplicationRaterEvent ):void
            {
                message( event.type );
            }

            private function applicationRater_dialogCancelledHandler( event:ApplicationRaterEvent ):void
            {
                message( event.type );
            }

            private function applicationRater_selectedRateHandler( event:ApplicationRaterEvent ):void
            {
                message( event.type );
            }

            private function applicationRater_selectedLaterHandler( event:ApplicationRaterEvent ):void
            {
                message( event.type );
            }

            private function applicationRater_selectedDeclineHandler( event:ApplicationRaterEvent ):void
            {
                message( event.type );
            }




    private function applicationId_retrievedHandler( event:ApplicationIDEvent ):void
            {
                message( event.type + "::"+event.applicationId );
            }

            private function applicationId_errorHandler( event:ApplicationIDEvent ):void
            {
                message( event.type + "::"+event.error );
            }       















            protected function announceStatus(e:StatusEvent):void 
            {
                // trace("Status change. Current status: " + monitor.available);

                if(monitor.available){
                    tsiko.beto=true;
                }else{
                    tsiko.beto=false;
                }
            }


            protected function onEvent(event:AdEvent):void {

    }

    protected function onInitEvent(event:AdEvent):void {
            _initOK = true;
    }

    protected function onCacheEvent(event:AdEvent):void {
            _cacheOK = true;
    }

    protected function onCloseIntersEvent(event:AdEvent):void {
            _inters.cacheInterstitial(_intersAdUID);
    }


    ////////////




    private function reklamdoksan(E:Event):void{
                  if(_initOK && _cacheOK && tsiko.reklamgel) {
                    _inters.showInterstitial();
                      tsiko.reklamgel=false;
            }
            }










        }

    }

0 个答案:

没有答案