1 Reply Latest reply on Oct 14, 2010 2:09 PM by Devtron

    CDATA error

    miquael Level 1

      In Flash Builder, I'm getting this problem:

       

      "invalid character or markup found in script block.  Try surrounding your code with a CDATA block".

       

      Tho in fact, my code is already surrounded with a CDATA block, and the syntax is correct. What is the problem here? 

       

       

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                        xmlns:s="library://ns.adobe.com/flex/spark"

                        xmlns:mx="library://ns.adobe.com/flex/mx"

                        implements="com.rfm.interfaces.IExercise"

                        xmlns:assets="com.rfm.assets.*"

                        xmlns:tapat="com.bpi.tapat.*"

                        width="800" height="600">


          

           <fx:Script>

           <![CDATA[

               

       

                import TPController;

               

                import TPModel;

               

                import TPViewer;

               

                import com.rfm.assets.AssetContainerMgr;

                import com.rfm.events.ExerciseEvent;

                import com.rfm.interfaces.IExercise;

                import com.rfm.state.GameState;

                import com.rfm.state.TaskModel;

                import com.rfm.test.TestInterface;

               

                import flash.events.*;

               

                import mx.controls.Alert;

                import mx.core.UIComponent;

               

                private var _spec:Object;

                public var startupAssets:Array = ['tapat_assets', 'global_assets'];    

               

       

                public function startup(spec:Object, previousstate:Object):Boolean {

                     GameState.fromJSON(previousstate);

                     TestInterface.instance.register_object(this, 'currentExercise');

                     _spec = spec as TaskModel;

                     ldrview.load(startupAssets);

                     return true;

                }

               

                public function kill():Boolean{

                     return true;

                }

               

                public function status():Object{

                     return GameState.toJSON();

                }

               

                public function pause():void{trace("pause");}

                public function resume():void{trace("resume");}

               

                public function easyConfig():void{trace("easyConfig");}

                public function mediumConfig():void{trace("mediumConfig");}

                public function hardConfig():void{trace("hardConfig");}

                public function easyStimulus():void{trace("easyStimulus");}

                public function mediumStimulus():void{trace("mediumStimulus");}

                public function hardStimulus():void{trace("hardStimulus");}

               

                public function prePrompt():void{

                     currentState = 'stimulus';

                     init();

                }

               

                public function prompt(e):void{    

                     GameState.write('did_tut', true);

                     currentState = 'prompt';

                }

               

                public function nextTrial():void{

                     currentState = 'stimulus';

                }

                //

                public function trialComplete(correct:Boolean):void{

                     AssetContainerMgr.playMP3(correct?'ding':'thump')

                     prompt();

                }

               

                private function finished():void{

                     dispatchEvent(new ExerciseEvent(ExerciseEvent.FINISHED, {}))

                }

               

                private function problem():void{

                     dispatchEvent(new ExerciseEvent(ExerciseEvent.ERROR, {message: 'happy fun error'}))

                }

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

               

                private function init():void{

                     var container:UIComponent = new UIComponent;

                    

                     var TPM:TPModel = new TPModel();

                     var TPV:TPViewer = new TPViewer();

                     var TPC:TPController = new TPController();

                }

                    

           ]]>

           </fx:Script>

       

          

           <s:states>

                <s:State name="loading"/>

                <s:State name="prompt"/>

                <s:State name="stimulus"/>

           </s:states>

       

          

           <assets:AssetLoaderUI id="ldrview" done="prePrompt()" includeIn="loading"/>

          

           <tapat:TAPATSkin id="bg" excludeFrom="loading"/>

       

          

           <fx:Declarations>

                <tapat:colorfilters id="colorfilters"/>

           </fx:Declarations>

       

          

           <s:Button label="skip" click="finished()" skinClass="com.rfm.skins.TxtBtn"/>

          

      </s:Application>

       

       

        • 1. Re: CDATA error
          Devtron Level 3

          You have a bracket missing or a bad character somewhere. Im not going to dig it out for you.

           

          I would suggest removing all the code and pasting it back in, piece by piece. That will help you figure out where the bad syntax/character is.

           

          I noticed this too:

          AssetContainerMgr.playMP3(correct?'ding':'thump')

           

          ^ not sure if you need a semicolon at the end there???

          1 person found this helpful