How to use gotoandplay scene link using class property (external code.as)

Hello
I am using ‘gotoandplay’ scene by scene link using this code. If I use this in the same time line (internal), it’s working properly but when I use this code in as a class, I got this error
Call to a possibly undefined method MovieClip.
I use this code in time timeline
b_enter.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_enter1);
function fl_ClickToGoToScene_enter1(event:MouseEvent):void
            MovieClip(this.root).gotoAndPlay("p menu", "Menu");
I use this code in class
package  {
            import flash.display.SimpleButton;
            public class next extends SimpleButton {
                        public function next() {
                                    // constructor code
                                    MovieClip(this.root).gotoAndStop("p2", "page2")
u can download the flash file using this link
http://www.delta-adv.com/nav/np.rar

oops, i didn't notice you were trying to add that code in a button class and were nesting named functions.  use:
package  {
                    import flash.display.SimpleButton;
                    import flash.display.MovieClip;
                    import flash.events.MouseEvent;
                    import flash.events.Event;
                    public class np extends SimpleButton {
                    public function np() {
this.addEventListener(Event.ADDED_TO_STAGE,init);
private function init(e:Event):void{
MovieClip(this.root).addEventListener(Event.RENDER,renderF);
                                this.stage.invalidate();
                                MovieClip(this.root).nextScene();
private function renderF(e:Event):void{
                                          MovieClip(this.root).gotoAndStop(5);

Similar Messages

  • How to use nextScene.gotoandplay link using class property (external code.as)

    i try this code but i got error
    package  {
                            import flash.display.SimpleButton;
                            import flash.display.MovieClip;
                            import flash.events.MouseEvent;
                            public class np extends SimpleButton {
                            public function np() {
                                                    this.addEventListener(MouseEvent.CLICK, clickF);
                                                    private function clickF(e:MouseEvent):void{
                                                    MovieClip(this.root).nextScene(),gotoAndStop(1);
    Call to possibly undefined method gotoanStop
    Note: i want to go next scene

    Thx guys
    I got the solution
    package  {
                            import flash.display.SimpleButton;
                            import flash.display.MovieClip;
                            import flash.events.MouseEvent;
                            public class np extends SimpleButton {
                            public function np() {
                                                    this.addEventListener(MouseEvent.CLICK, clickF);
                                                    private function clickF(e:MouseEvent):void{
                                                    MovieClip(this.root).nextScene();

  • How to use classes of packages in flex mx:Script/ or mxml/

    Hi.I am just learning Flex using Flex Builder 3 facing one problem,
    Suppose I declare one package with name alert.as
    package
    import mx.controls.Alert;
    public class alert
    public function alertBtn()
    Alert("Hello btn 1");
    Now in want to use the function in mxml that I declared in a package.
    <mx:Button label="btn1" click="alertBtn();"  />
    I have few questions
    1)How to Import the class alert.as in <mx:Script> and where should i store the file alert.as in the directory folder of flex?
    2)How to call the function alertBtn() when btn1 is clicked.
    Thanks so much!
    Regards
    Ankur

    Hi Greg.I think I was not able to clear my problem properly.Let me try this time again.
    What I wanted to do was that in the below written code I have the full access of the id=panel1 in the  script tag .This works properly.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import flash.display.Sprite;
    import mx.core.UIComponent;
    private function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="addChildToPanel();"/>
    </mx:Application>
    This above functionality when I tried to do using class Outside the code ,its not working !
    Here is with the package:-
    But suppose I make One package 
    package
    import flash.display.Sprite;
    import mx.core.UIComponent;
    class getPanel extends Sprite
    public function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
              }//class
                        }//package
    Now in MXML
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import getPanel;
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="getPanel.addChildToPanel();"/>
    </mx:Application>
    So My problem is that this code doesnt do anything.
    Neither the addChild function is working in it ,Nor the Panel1 is accessible here.
    Can u pls help me here.
    Thanks
    Ankur

  • Need samples how to use classes in WebDynpro

    Hi,
    I Need To simple Samples how to use classes in WebDynpro.
    Regards

    Continued....
    and in the model
    right click->create model
    select the radio button import java bean .
    next ADD jars option will be seen
    Browse the jar on the dekstop.
    now add this model to the used models by right clicking on it.
    Now if you go to Data Modeler.
    You will find the used model.
    From there map to the component controller->view Controller.
    And continue with ur coding.
    Hope this helps you.
    Thanks & Regards,
    Lokesh.

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • How to use the property-loader?

    Hello,
    i´m using TS 3.5 and LV 8.0. Now i also want to use the built-in property-loader from Teststand.
    Is there somewhere a documentation for "beginners" how to use this property-loader? At the end i want to read parameters from an ascii-file which updates my input-parameters of the steps in the current-sequence.
    I know how to read and change parameters from teststand in labview via active-x, but i have no idea how to use this propertyloader-thing.
    Is there an easy help file somewhere in the net ( I havent found one yet)?
    Thanks for your help.

    Meanwhile i can use the propertyloader for Limits and Variables which are in a container of the teststep. What not worked was:
    1.) setting the properties of a "Messagebox". For example the property "Button1Label". Why is this not working?
    2.) The second thing what is not clear: Do i need for each sequence an own property-loader? I tested it with a sequence with one subsequence. Does the subsequence needs its own property-loader?
    Currently the import-csv-file looks like this:
    Start Marker,,,
    <Step Name>,Limits.Low,Limits.High,Cont.Voltage
    TestStep_1,1,2,4
    TestStep_2,8,16,32
    End Marker,,,
    When Teststep_1 and Teststep_2 are both in mainsequence then it works. When i copy Teststep_2 in a subsequence then i get an error (-18).
    Any ideas about my two questions?
    Thanks

  • How to disable "blue underlined links" (which I did not code) in FireFox?

    How to disabl "blue underlined links" (which I did not code) in FireFox? Here's an example website that has no underlined links coded in the simple html source: www.setv.org. After I updated FireFox to a more recent FireFox version, blue underlines appear in websites. I know that there is a way to disable that annoying 'feature'.
    Thanks in Advance
    tron nee
    Electro-Optical Tech*Artist
    Los Angeles Burning Man Artist Association
    burner et von tron

    Cor El,
    Thank you. Re; under-lined links...I thought I looked everywhere...but I missed it!
    Any chance there being a way to easily enable/disable animations? I'd sure like to selectively rid the screen of those noisy flashy-blinky advertisements.
    And how about storing java-script enable/disable flags with bookmarks? That way I would not be forced to click tools->options->content->enable-javascript each time I wanna turn it on or off? When I surf using database engines I disable j-script (phkem) and when I need to get something from nextegg I turn it on. What about being able to selectively disable/enable (also stored in bookmarks) embedded google-ads/beacons flags? I hate being tracked, now I'm getting ads on my cable TV set based on where I've been lurking on the InterNet. Big-phkn-brother's on us, and its the greedy phkn corporations who don't give sht about us except for what's in our wallets. InterNet used to be cool, now its the CIA, the FBI, KGB, policia, FartBuuk, Macro$haft, AT&T, Giggle (at least they give something of value back), and all the other facist big-brothers. Mozilla was born fighting that schema. There's so much more that FireFox could do to mitigate InterNet facism.
    Anyway, thanks again for your time and I appologize for the ranting.
    burner von tron

  • How to use Class "CL_GUI_CHART_ENGINE" in a abap program ?

    Hi Guys,
    I want to display data in my internal table in the form of a Graph using class "cl_gui_chart_engine".
    I had a look at sample program given by SAP - GRAPHICS_GUI_CE_DEMO but need some help to understand how can we use our own data to be displayed in the graph ? Basically what I am looking for is that where we need to do the changes in creation of XML file so that we can pass our own data ?
    ( perform create_data_demo using l_ixml_data_doc)
    Could you please help me with some sample code or pseudocode ?
    Thanks
    Ashwa

    Thanks Kai,
    I had already done the same thing and got the required output.
    Populate X-Axis ( Categories )
      LOOP AT ITAB.
    Populate Categories
        l_element = p_ixml_doc->create_simple_element(
                  name = 'C' parent = l_categories ).
        l_element->if_ixml_node~set_value( itab-value).
      ENDLOOP.
    Populate Y-Axis ( Values )
      LOOP AT VALUE_TAB.
       l_element = p_ixml_doc->create_simple_element(
                 name = 'S' parent = l_series ).
        l_element->if_ixml_node~set_value( value_tab-value).
      ENDLOOP.
    I am now trying to find the ways to change the default layout of the graph. I guess it should be done in "perform create_custom_demo using l_ixml_custom_doc." . I want that my graph should be displayed as lines instead of bar's.
    Once I achieve this I will share my findings along with sample code with the community.
    I wish I could get some documentation on class "cl_gui_chart_engine" and interfaces like "if_ixml_document".
    Thanks
    Ashwani

  • How to use class.getResource() to create an ImageIcon

    Hi,
    I am well acquainted with creating and using ImageIcon icons using the ImageIcon constructor
    and putting the image file in a folder called Images which is at the same level as the
    bin and src folders.
    I discovered a demo program, LayeredPaneDemo, that uses class.getResource() to create
    an icon and found that in my eclipse version, the icon's image file was not found when
    I used the original getResource() call but the icon was created when I used the ImageIcon
    constructor.
    I posted on JavaRanch and eventually realized that the image file needed to be with the
    .class files, so I moved the Images folder under bin and getResource() works fine and I'm
    happy.
    However, I have three questions for you.
    One poster on JavaRanch told me that it's better to use getResource() rather than the
    ImageIcon constructor for distributing an app (I'm not distributing anything but want
    to do it all correctly).
    Do you agree with that or can I safe keep using the ImageIcon constructor?
    Another poster told me he doesn't think it's safe to leave the image file in bin because
    it might be lost during the build in eclipse and that there is a way to have eclipse copy
    the files to bin during the build which should mean that I can leave the images folder at
    the level of bin and src.
    Do you agree with that?
    If yes, how do I get eclipse to copy the file during the build?
    P.S.
    Before I posted on JavaRanch, I put the Images folder at every level of the project's
    directory as shown in eclipse (which is why I missed the bin folder until JavaRanch
    whacked me upside the head) and getResource() still didn't work.

    The contents of the Java Source folder are compiled if they're source files, copied otherwise (assuming no filter's been put in place to prevent copying), so your images belong under a source folder.

  • How to use classes CL_DOCX_*

    We have a need to use word 2007 OOXML classes  all of which start with CL_DOCX*.
    Basically what we are trying to do is take a DOCX files (File 1 & File 2) saved by MS WORD 2007 application and replace the header of File 1 with the header from File 2.
    The basic functionality described above is working fine. However the same is not working when the header from File 2 has an IMAGE embedded in it.
    We found several  word 2007 OOXML classes  in the system (all of which start with CL_DOCX*), but couldn't find usage for these classes anywhere in the system or SDN or OSS Notes etc.,
    Just wondering whether anyone used these classes in their development environment and whether they can share this information here?
    Any help in this regard is highly appreciated.
    thanks,
    -Sreenath

    Which NetWeaver release are you using? The whole OOXML seems to be evolving within EhPs.
    You'll find examples how to use the framework in the Unit Tests of class CL_DOCX_FORM - so have a look at those classes. For me those test code runs fine.
    Best Regards,
    Tobias

  • How to use classes in Actions tab

    Hello guys!
    I'm just a beginner so i'm sorry for my stupid question.I'm developing a game in which movie clips in our case people have their own schedule.I have multiple screens and so i want to be able to set their locations and make them invisible on other screens(rooms)they're not currently at.The trouble is i can't use variables from Actions in my class,neither can i use classes in my Actions.Can anyone tell me how to export classes into Actions code?
    Here is my code:
    var currentlocation;
    var currentscreen;
    if (person.currentlocation!==currentscreen){
    person.visible=false;
    btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
    function fl_MouseClickHandler(event:MouseEvent):void
              currentscreen = "classroom";
              classroom.visible = true;
              playroom.visible = false;
    btn_2.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
    function fl_MouseClickHandler_2(event:MouseEvent):void
              currentroom = "playroom";
              classroom.visible = false;
              playroom.visible = true;

    Your problem/question is not clear to me.  If you are getting errors you should include the error messages in your posting.
    Could the problem arise from using a variable that is not defined?
    currentroom = "playroom";
    I do not see currentroom defined as a variable anywhere.  There is a currentscene variable though.

  • How to use class in JSP file?

    Hello All,
    I am new to Jsp.
    In Jsp file,I used class of myself.
    Why,the Constractor seems not working?
    Thanks in advance.

    Hi,
    You can import the class in a jsp file.
    Use <% page import = "">
    and call that class.
    If u want to import a funtion in your class, then u can insert that into scriplets like <%! ..%>
    Hope u got that!
    Artz

  • How to use class.forName

    I am trying to use Class.forName() from a string which is passed to me as argument.
    Class batchClass = Class.forName(args[1]);
    A jar file contains the class file for the string received above and I have this jar file in the manifest of my executable jar.
    I get a class not found exception when I run my executable jar
    Can some body give pointers..what could possibly be the issue.
    The jar file is in my classpath
    run script
    #!/bin/csh
    java -jar -DDBPROVIDER=NO -DDBUS_ROOT=$DBUS_ROOT -DVTNAME=$VTNAME ./jar/IntraDayDepotPositionBatch.jar MagellanStart IntraDayDepotPositionBatch INPUTFILE LOGFILE
    Exception
    Magellan program starting - program class IntraDayDepotPositionBatch
    Cannot find program class - IntraDayDepotPositionBatch
    IntraDayDepotPositionBatch
    java.lang.ClassNotFoundException: IntraDayDepotPositionBatch
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at com.db.mmrepo.app.IntraDayDepotPositionBatch.MagellanStart.main(Unknown Source)
    Thanks for your time and feedback on this

    actually i tried both...with package name and without package name..
    nothing worked...
    my manifest file also contains the path to the package..so does the classpath

  • How to use classes from an existing outside library ?

    Dear People,
    I added a library to use classes already built.
    In JBuilder7 I went to Tools | ConfigureLibraries
    and added the objectdraw library. At the left when I look in the
    directory structure under User Home is "objectdraw" so I did
    add the library correctly but when I put in the coding a try
    to run it, the error messages say:
    "MakeBox.java": Error #: 200 : <identifier> expected at line 8,
    which is the line : public void MakeBox()
    The entire code is :
    package stan_e_makebox;
    import objectdraw.*;
    import java.awt.*;
    public class MakeBox extends WindowController
    void public MakeBox()
    public void onMousePress(Location point)
    new FilledRect(40,80,30,20,canvas);
    public static void main(String[] args)
    new MakeBox();
    Thank you in advance
    Stan

    oo sorry,
    this is the constructor i assume, so should be
    public MakeBox()

  • How to use class for Translate..codepage/numer format

    In the Unicode context, TRANSLATE... CODEPAGE/NUMBER FORMAT is not allowed.

    this is the class to be used for  Translate…Codepage/number format.statement
    Unicode Error : In the Unicode context, TRANSLATE... CODEPAGE/NUMBER   FORMAT is not allowed.
    Before Unicode
      TRANSLATE T143T-TBTXT FROM CODE PAGE '1100' TO CODE PAGE '1105'.
    After Unicode
       Use class for Translate codepage to codepage.
         Data : g_codepage LIKE tcp0c-charco VALUE '1100'.
    CONSTANTS: c_unicodecp(4) VALUE '1105'.
    PERFORM translate_codepage USING g_codepage
                                     c_unicodecp
                               CHANGING T143T.
    FORM translate_codepage  USING    P_G_CODEPAGE
                                      P_C_UNICODECP
                             CHANGING P_T143T.
      DATA: converter  TYPE REF TO cl_abap_conv_obj.
      DATA: l_out      TYPE string.
      DATA: l_fromcode TYPE cpcodepage.
      DATA: l_tocode   TYPE cpcodepage.
      l_fromcode = P_G_CODEPAGE.
      l_tocode = P_C_UNICODECP.
      CREATE OBJECT converter
        EXPORTING
          incode  = l_fromcode
          miss     = '.'
          broken   = '.'
          use_f1   = 'X'
          outcode  = l_tocode
        EXCEPTIONS
          invalid_codepage = 1
          internal_error   = 2.
      IF sy-subrc <> 0.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
          WHEN 2.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
        ENDCASE.
      ENDIF.
      CALL METHOD converter->convert
        EXPORTING
          inbuff         = P_T143T
          inbufflg       = 0
          outbufflg      = 0
        IMPORTING
          outbuff        = l_out
        EXCEPTIONS
          internal_error = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
          WHEN 2.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING unknown_error.
        ENDCASE.
      ENDIF.
      P_T143T = l_out.
    ENDFORM.                    " translate_codepage

Maybe you are looking for