error 1066 - drag is not a function.

I have the following

(1) Main.as - a document class

(2) main.fla - the document with a circle

(3) Drag.as - with drag code

Drag is not a function is thrown. This means that main.as cannot access custom drag function but how is this possible if

It is public and in the same folder?

Thanks in advance.

MAIN.as

package {}

import flash.display. *;
import flash.events. *;
import drag;

SerializableAttribute public class Main extends MovieClip
{

public void Main (): void
{
circle. drag (); This is how you implement a method NOT Drag (circle);
}


}
}

DRAG.as

package
{
import flash.display. *.
import flash.events. *;
//————————————
Drag/public class extends MovieClip {}
public var clip: MovieClip = new MovieClip();
//————————————
public void Drag() {}

}
public function drag (): void {}
this.addEventListener (MouseEvent.MOUSE_DOWN, onMouseDownF) ;// we use it to indicate the object (instance of the class) who called (named) it.
this.addEventListener (MouseEvent.MOUSE_UP, onMouseUpF);
}
//————————————
private void onMouseDownF(e:Event):void {}
this.startDrag)
}
//————————————
private void onMouseUpF(e:Event):void {}
this.stopDrag ();
}
}

In addition, you must always specify namespace (such as public, private, protected, internal, etc.) when you declare variables.

In addition, do not use datatyoe back with constructor. Constructor creates an object of the instance itself.

Try this with the circle on the timeline:

package {
     import flash.display.*;
     import flash.events.*;

     public class Main extends MovieClip
     {
     public var circle:Drag;
        public function Main()
        {
               circle.drag();
          }
     }
}

Tags: Adobe Animate

Similar Questions

  • TypeError: Error #1006: value is not a function.   mdas_fla::MainTimeline/ans() problem

    can you help me with this. This error pop up when I run my fla file.

    TypeError: Error #1006: value is not a function.

    at mdas_fla::MainTimeline/ans()

    This is my code:

    import flash.events. *;

    Import flashx.textLayout.conversion.PlainTextExporter;

    equal_btn.addEventListener (MouseEvent.CLICK, years);

    function ans(event:MouseEvent):void

    {

    var op: Array = new Array (String [10]);

    var num:Array = new Array(Number[10]);

    var dock: String;

    result_txt. Text = input_txt.text;

    keep = input_txt.text;

    var g:int = 0; var ctr:int = 0; var ctr2:int = 0; var str:String ="";

    while(g < Hold.Length)

    {

    If (hold.charAt (g) == '+' | hold.charAt (g) == '-' | hold.charAt (g) == ' *' | hold.charAt (g) == ' / ')

    {

    OP [ctr] = ' "+ hold.charAt (g);

    trace (op [CTR]);

    CTR ++; Ctr2 ++; Str ="";

    }

    on the other

    {

    Str += ' ' + hold.charAt (g);

    NUM [ctr2] = parseInt (str);

    trace (num [Ctr2]);

    }

    g ++ ;

    }

    var pl:int = 0; var val: Number = 0;

    for (var a: int = 0; has < op.length (); a ++)

    {

    Try

    {

    If (op [a] == ' *')

    {

    NUM [pl + 1] = num [pl] * num [pl + 1];

    }

    ElseIf (op [a] == ' /')

    {

    NUM [pl + 1] = num [pl] / num [pl + 1];

    }

    ElseIf (op [a] == '+')

    {

    NUM [pl + 1] = num [pl] + num [pl + 1];

    }

    on the other

    {

    NUM [pl + 1] is [pl] - [pl + 1] num num;.

    }

    }

    catch (error)

    {

    Val = num [pl];

    break;

    }

    PL ++;

    }

    trace (Val);

    result_txt. Text = "" + val;

    }

    pls... Help me solve this problem...

    Length() must be of length.  That is to say, the class array has a length property, no method.  Flash thinks you are trying to define a new function, length().

    PS so that debugging, click file > publishing settings > swf and check the box "enable debugging" so the number of problematic line of your error (s) is in error messages.  This makes it much faster to debug your code.

  • Error #1006: setChildIndex is not a function.

    This part of my application when I run:

    var topPosition:uint = this.numChildren - 1;

    .

    .

    .

    function showSettingPage2(event:MouseEvent):void
    {
    ...

    settingPage1.visible = false;
    settingPage2.visible = true;
    this.setChildIndex (settingPage2, topPosition);
    }

    I get this error:

    TypeError: Error #1006: setChildIndex is not a function.

    While in my app several times I used this method without error:

    this.setChildIndex (MovieClip, topPosition);

    Moreover, I know than the other method to put "settingPage2" on the top it is (and it works):

    stage.addChild (settingPage2);

    But I don't want to add a new child, please, someone knows why I get the above error?

    Thank you very much
    Ali

    because ' ' is not a displayobjectcontainer.  That is to say, check your goggle.

  • Error #1006: textBoxSet is not a function

    Here's a little background on myself and this error:

    I tried to solve this problem for about 2 hours, no other than how or resolve. I am a Java programmer and the tutor in my school and to this language, because it was "easier" to have GUI, animation and interaction. As a result, I'm still stumbling around actionscript a little.

    As or right now, copy the following code is for 1) set up a red rectangle movieClip, 2) move 200 pixels and 3) do call a function "textBoxSet' of the VeggieDisplay class that is imported and supposed to work.

    1 and 2 work very well, because they are relatively easy steps. However, when I try to launch displayItem.textBoxSet (); I get:

    TypeError: Error #1006: textBoxSet is not a function.

    at ProduceProject_fla::MainTimeline/frame1()

    I'm not sure why this is happening. I have everything set up and it should work. The methods are not nested, etc. etc. and such.

    For now, that's all I ask. I don't want to worry about the other thing that does not work more later (class element is not set in the timeline when should not be etc..)

    Code in the Timeline to Frame 1:

    import packages. VegetableDisplay;

    var displayItem:VegetableDisplay = new VegetableDisplay();

    trace (displayItem);

    displayItem.x = 200;

    this.addChild (displayItem);

    displayItem.textBoxSet ();

    Code for VegetableDisplay:

    the package packages {}

    import flash.display.MovieClip;

    import packages. Vegetable;

    import flash.text.TextField;

    SerializableAttribute public class VegetableDisplay extends MovieClip {}

    public var veggieItem:Vegetable;

    two text boxes are in the movieclip

    var nameText:TextField = new TextField();

    var typeText:TextField = new TextField();

    "Builder". Do not build a large part

    public void VegetableDisplay() {}

    the constructor code

    trace ("9");

    veggieItem = new Vegetable();

    trace ("veggieItem" + veggieItem.getName ());

    }

    set these text boxes in the movieClip

    private void textBoxSet (): void {}

    trace ("in");

    nameText.text = veggieItem.getName ();

    typeText.text = veggieItem.getType ();

    }

    }

    }

    Class of vegetables:

    the package packages {}

    public class {vegetables

    / * Actually, I have a problem with this class as well. When values are called the form, they come as "not defined" rather than what they should be.

    Why and how I could fix TI * /.

    private var myName:String = new String();                                        element name

    private var typeNum:Number = 0;                                                                      0: vegetable 1: fruits

    private var myType:String = new String();                                        corresponding channel

    private var classNum:Number = 0;                                                            fruit kernels and other

    private var itemClass:String = new String();                                        corresponding channel

    private var growingSeason:Array;                                                            month

    private var growingArea:Array;                                                                      areas

    public void Vegetable() {}

    the constructor code

    myName = "tomato."                                                                                           temporary up to begin importing rather than static.

    myType = "fruit";

    }

    Get methods

    public function getName (): String {}

    return MyName;

    }

    public function getTypeNum (): number {}

    TypeNum return;

    }

    public function getType (): String {}

    Return myType;

    }

    public function getClassNum (): number {}

    Return classNum;

    }

    public function getItemClass (): String {}

    return itemClass;

    }

    public function getGrowingSeason (): Array {}

    return which;

    }

    public function getGrowingArea (): Array {}

    Return growingArea;

    }

    Methods of definition

    public void setName (mName) {}

    myName = mName;

    }

    public void setTypeNum (tyNum) {}

    typeNum = tyNum;

    }

    public void setMyType (mType) {}

    myType = mType;

    }

    public void setClassNum (claNum) {}

    classNum = claNum;

    }

    public void setItemClass (itClass) {}

    itemClass = itClass;

    }

    public void setGrowingSeason (growSeason) {}

    Which = growSeason;

    }

    public void setGrowingArea (growArea) {}

    growingArea = growArea;

    }

    }

    }

    Any help would be greatly appreciated. Thank you.

    Class vegetable added if anyone bothers to build the class and test. The composition of the text box is just a rectangle with two text boxes "nameText" and 'typeText' so far, the dynamic and other text value.

    Also realized that I have never done with the name of the issue, so I did it is less ambiguous.

    You can start with a new set of files.  If I am controlled by using your last interpretation of the VegetableDisplay class so that other elements of coding your first assignment I get no error and exit following...

    9

    veggieItem tomato

    [object VegetableDisplay]

    in

  • TypeError: Error #1006: value is not a function.

    I get this error:

    TypeError: Error #1006: value is not a function.
    at project_fla::MainTimeline/createMap()
    at project_fla::MainTimeline/frame1()

    The following actionscript code:

    [A]

    function createMap(target:Object,_map:Array,_tilesize:Number):void {}
    for (var ix:Number = 0; ix < card [0] .length; ix ++) {}
    for (var iy:Number = 0; iy < map.length; iy ++) {}
    This ["t" + String (IX) + "x" + String (iy)] = new Object();
    This ["t" + String (IX) + "x" + String (iy)] = new tile();
    This ["t" + String (IX) + "x" + String (iy)] .gotoAndStop (Map [ix] [Iy]);
    This ["t" + String (IX) + "x" + String (iy)] .x = Flxy (new Point(ix,iy), tilesize) .x;
    This ["t" + String (IX) + "x" + String (iy)] = Flxy (new Point(ix,iy), tilesize) there there;
    target.addChild (this ["t" + String (ix) + "x" + String (iy)]);
    }
    }
    }

    {/ A]

    What is the problem with the code?

    There are go. You must give your clip on stage an instance name - when you select the clip - the name of the instance is the field above the behavior instance drop-down list at the top of the properties panel.

  • Get the error: DROPDOWN list is not a function - works in IE9

    I'm trying to remove the default selected value in a drop-down list.

    The call to the function is the following:
    OnChange = "JavaScript:Remove_Default_Value (this); »

    Here's the function:

    function Remove_Default_Value(DROPDOWN) {
     var i = DROPDOWN.options.length - 1;
     for ( i; i >= 0; i--)
     {
      DROPDOWN(i).defaultSelected = false;
     }
    } 

    The error I get is "drop-DOWN list is not a function".

    Any ideas is greatly appreciated.

    It is not a function, but a table and you also use getElementsByTagName()

    function Remove_Default_Value(DROPDOWN) {
     var i = DROPDOWN.getElementsByTagName("option").length - 1;
     for ( i; i >= 0; i-- )
     {
      DROPDOWN.getElementsByTagName("option")[i].defaultSelected = false;
     }
    } 

    A good place to ask for advice on web development is to the 'Web Standards Development/evangelism' MozillaZine forum.

    Aid to this forum are better informed on issues related to web development.

    You must register on MozillaZine forum site to post in this forum.

  • error TypeError: Error #1006: invalidateList is not a function. ?

    Hello

    I update the data for a tree control. Whenever I call it tree.invalidateDisplayList () or tree.invalidateList (), I always get an error saying that it is not a function.  Someone saw this beast before and if you slayed it, what did you use.


    Here is the offending code:

    public void click(event:Event):void
    {
    var object: = dataTree.openItems;
    dataTree.invalidateList ();                              //Process kicks the buc KET here
    xmlList = new XMLListCollection (xml2.user);
    dataTree.openItems = object;
    }

    Sincerely,

    D

    The error is thrown because dataTree is an array of trees and it's because your tree is declared in a Repeater. You can access individual trees using the dataTree [0], dataTree [1], etc. However, I'm not sure of what to need to invalidate the trees because the Repeater will update after the click handler, causing the trees to be recreated.

    Also note that XML does not need to be declared as a string in Actionscript. Compile the following text:

    [Bindable]
    public var xml2:XML =


                 

    ;

  • Error "app.addMenuItem is not a function".

    Hey,.

    New to Acrobat and Javascript in general.  I wanted to be able to create a custom toolbar with four buttons when a document is loaded (we don't want the buttons on the documents themselves), and I copied and pasted the following code in a module named "Open" to give me an example of how the controls work.  When I run it, I get the error in the title of the thread.  So I copied the first block of code - the "addMenuItem" command in the Javascript console and tried to run from there, and I get the same error.  Someone has an idea of what's going on here?  Thanks for any help you can give me.

    function() {return A.apply (null, [this] .concat ($A (arguments)))}


    //-------------------------------------------------------------
    -Do not change the tags XML-
    //-------------------------------------------------------------

    > to the document level.
    Open < ACRO_source > < / ACRO_source >
    < ACRO_script >
    / * belongs to: Document-level: open * /.
    var atbtoolbuttons;
    app.addMenuItem({)
    cName: "atbToolButtonSet."
    cUser: "my Menu."
    cParent: 'tools. '
    cMarked: "event.rc = ((typeof atbtoolbuttons! = "undefined") & &! atbtoolbuttons). "
    cEnable: "event.rc = (event.target == null);"
    cExec: 'loadATBToolButton();', NPO: 0
    });

    var loadATBToolButton = app.trustedFunction (function)
    {
    If (typeof atbtoolbuttons is "undefined")
    atbtoolbuttons = true;
    else {}
    If (! atbtoolbuttons) {}
    app.removeToolButton ("atbToolButton1");
    app.removeToolButton ("atbToolButton2");
    atbtoolbuttons = true;
    return;
    }
    }
    If {(atbtoolbuttons)
    app.beginPriv ();
    Get the path to the folder the user JavaScript
    var atbPath = app.getPath ({cCategory: Cfolders, "user": "javascript"});
    try {}
    Try to open the doc of the icon as in hidden mode and recover his doc
    object.
    var doc = app.openDoc ({}
    cPath: atbPath + "/ icon_toolbar.pdf" {, acachees: true}); ' "
    } catch (e) {console.println ("could not open file icon"); return ;}}
    Get the flow of the hidden myIcon1 of the doc icon
    var oIcon = util.iconStreamFromIcon (doc.getIcon ("myIcon1"));
    Add a tool button using this icon
    app.addToolButton({)
    cName: "atbToolButton1."
    oIcon: oIcon,.
    cExec: 'atbTask1();',
    cTooltext: "my toolbar button 1."
    NPO: 0
    });

    Download now myIcon2 of the document hidden.
    oIcon = util.iconStreamFromIcon (doc.getIcon ("myIcon2"));
    and install this toolbar and button
    app.addToolButton({)
    cName: "atbToolButton2."
    oIcon: oIcon,.
    cExec: "atbTask2()."
    cTooltext: "my toolbar button 2."
    NPO: 0
    });
    Close our document hidden with the icons.
    doc.closeDoc ();
    app.endPriv ();
    Set this variable to point out that the toolbars are installed.
    atbtoolbuttons = false;
    }
    })

    < / ACRO_script >
    < / at the level of the document >

    In the documentation, read the note for the addMenuItem method.

  • Error message: trim is not a function

    I can't get the standard string Trim() method works in Acro 11 Pro.

    What is happening with this?

    No work around?

    The string trim method was introduced with JavaScript 1.8.1. Acrobat 10/11 is documented as supporting 1.8, which I guess means 1.8.0. It is quite easy to create your own trim function, which will also work with the pre-10 versions Acrobat/Reader.

  • [CS3] [JS] error "everyItem() is not a function".

    I'm adapting ChangeCaseOfSelectedParaStyle of Dave Saunder to work a CS4 natively without version control with the CS3 version. See the following code:

    myDoc = app.activeDocument;

    myStyles = myDoc.allParagraphStyles;

    myStringList = myStyles.everyItem () .name;

    However, it throws the following error: myStyles.everyItem is not a function

    Any ideas? (or Dave, if you see that you already have an adapted version).

    Nye

    JavaScript is case-sensitive: use myDoc.paragraphStyles, not myDoc.ParagraphStyles

    Peter

  • Problem setting up of sublayer ("not a function")

    Hello. I came up with an idea for a script to read a data set and use it to manipulate objects inside of IT. The data is a simple table with several key: values, which matches the identifier of a "set of lines. I stored these values in an array of objects, where each object is a line.

    First I wanted to create a layer accession, where 1) each key of these objects of data would create a sub inside a main layer layer. (2) each value of a key would create a layer of sub within the previous layer of created under key. For now I am bypassing the problem of duplication, because the object will share several keys and values, and I don't want duplicates of those.

    For the moment I can not finish coz task (2) of the error: "parent.add (); is not a function ". Impossible to find out why, but I have to say that my programming skills are weak. Hope you can help me on this

    var doc = app.activeDocument;
    
    var layerPrincipal=doc.layers.getByName("RES");
    var subLayers=layerPrincipal.layers;
    
    
    //loteObj's are omitted for brevity.
    var lotesArrCom=[loteObj1,loteObj2]; 
    
    
    //Snipped that from the forum.
    function doesLayerExist(layers, name) {
      for (i=0; i<layers.length; i++) {
      if (layers[i].name==name) return true;
      }
      return false;
    }
    //Snipped that from the forum.
    function createLayer(parent,nome){
      var lay = parent.add();
      lay.name = nome;
    }
    //Loop trough an Array of Objects storing pairs of data.
    for(var i=0;i<lotesArrRes.length;i++){
      var loteObj=lotesArrRes[i];
      for (var key in loteObj) {
      if (loteObj.hasOwnProperty(key)&&key!="nome") {
      var keyValue=loteObj[key];
      if(!doesLayerExist(subLayers, key)){
      createLayer(subLayers,key){
    
      var keyValue=loteObj[key];
      var sLayers=subLayers.getByName(key);
      //It seems to stuck here. The previous function is executed as expected, but the following triggers the error in the 'CreateLayer' function declaration that "parent.add(); is not a function".
      createLayer(sLayers,keyValue){
      }
      }
      
    

    In the first case, you call "createLayer (sublayers, key);" - where sublayers = object [layers], in the second case, when you call "createLayer (sLayers, keyValue)' - where sLayers = object [layer] and layer property 'Add ()' is not available.

    That is to say in the first case, you call «createLayer (doc.layers.getByName ("RES").» Layers, key)", in the second case, you call"createLayer (doc.layers.getByName ("RES"). " Layers.getByName (key), keyValue) "- but in this case you forgot to add 'intact' - 'createLayer ( )

    doc.layers.getByName ("RES") layers.getByName (key) intact)«» ...

    //It seems to stuck here. The previous function is executed as expected, but the following triggers the error in the 'CreateLayer' function declaration that "parent.add(); is not a function".
    createLayer( sLayers.layers, keyValue );
    
  • number of $ is not a function

    Hello

    I try to use the number of jquery plugin https://github.com/teamdf/jQuery-number/

    I work with apex oracle 4.2

    in the shared components, I import the file static jquery.number.js

    in my page, in the URL of the javascript file, I add

    < script src = "" #WORKSPACE_IMAGES #jquery.number.js "type =" text/javascript"> < / script >"

    and to run when the Page loads.

    I put

    try {}

    var DD = $nombre (300, 1, ', ' ' ");

    Alert (jj);

    }

    {catch (Err)}

    Alert (Err);

    }

    When I run the page I got the error TypeError: $nombre is not a function.

    I don't know why.

    any help?

    concerning

    Jean-Marc

    Copied from the 'help' on the URL "Javascript > file.

    Enter the URL of the JavaScript file for the code to load this page. Each URL must be entered in a new line. If you provide a compressed version of your file, you can use the substitution string #MIN# to include .min in the URL of your file for a standard page view and an empty string if the page is displayed in debug mode. You also have access to the substitution string #APP_VERSION# If you want to include the version of the application in the URL of the file.

    URL of the JavaScript file you enter here replace him #PAGE_JAVASCRIPT# in the page template substitution string.

    Note: You don't need to include the opening or closing script tags. Just write the URL.

    Examples:

    • The standard file reference
    • /myjs/main.js
    • Reference standard file that loads the main.min.js file compressed to regular page views and main.js in debug mode.
    • /myjs/main#min#.js
    • Conditional file for Internet Explorer
    • [if IE]/myjs/ie.js
    • File reference using a query string in the URL referring to the version of the application, such that when the application is upgraded (and the version is incremented), the browser is to always load the new file and ignore all files previously updated cache.
    • /myjs/main.js?version=#APP_VERSION#

    So: Your include file is incorrect. Just add

    #WORKSPACE_IMAGES#jquery.number.js
    

    for the URL

  • Bug report: lItemValue.search is not a function in item.js

    When it point-Plugins in combination with dynamic actions that have a 'Not Null' condition (in the section 'When') the JS error "lItemValue.search is not a function" occurs when elements getValue does not return a string but a number.


    The error item.js to APEX 4.2.3 and 4.2.4 524 online product (does not check older versions), because number in JS types have methods *.search or .length (channels of support that).


    Oddly enough, there is this comment on line 490 of item.js: / / make life more easy and always use a string for all operations to compare! $v does not work in this context


    Unfortunately, this applies to tables only, no numbers.

    Hi Peter,.

    Thanks for reporting, I I produced bug # 18139003.

    Concerning

    Patrick

  • apex.jQuery is not a function

    Hello

    I was using apex 3.2 with extjs 2.02 and everything worked fine. We have now upgraded Apex to Application Express 4.1.0.00.32 and I get the following error:

    apex.jQuery is not a function
    {Apex.jQuery (document) .ready (function () [break On This Error]
    f? p = 10... 25: (line 239)
    apex.jQuery is not defined
    [Break on this error])} return this.pushStack(d,a,e.selector...ex.event.gCancelActions=false})}}; / * !
    apex_4_1.min.js (line 18)


    I searched the forums without much joy. If this has been previously validated with a solution can someone point me there. Any help will be greatly appreciated.

    Thanks in advance.

    Praj,

    Well if it works, then it must be some kind of colission or conflicts with your different javascript libraries that you use. It's almost impossible to debug via the forum. If there is a conflict, you might want to try to reference your custom first, libraries then the apex files as I am pretty sure apex uses jQuery.noConflict)

    Good luck
    Janet Tyson

  • setResult is not a function, = &gt; but it is!

    Why do I get this error for this code

    TypeError: Error #1006: setResult is not a function.
    the mock: AuthenticationServiceMock / applyResult)

    private void applyResult(token:AsyncToken,_result:Object):void {}

    mx_internal:token.SetResult (result);

    var event: ResultEvent = new ResultEvent (ResultEvent.RESULT, false, true, result, token);

    mx_internal:token.applyResult (Event);

    trace (Token);

    }

    Try this after the import statements:

    use namespace mx_internal;
    

    and remove the prefixes

Maybe you are looking for

  • charging iPhone problem

    Hey,. can you guys tell me what to do now? I got ip4s for 2 years. official charger lasted over a year, the good Chinese months walked, then 20th party 3 years and a half and the other but cheaper for another half year (cables). Now I think its time

  • I lost my tab '+' in my toolbar. How to restore?

    I lost my tab '+' in my toolbar. How to restore? I could restore my + (to open a new tab). The only way I can open new tab now, is I have 1 (new tab) button on the upper right corner of my screen.

  • HP Pavilion p6-2117cPC: withdrawal of cdr burner on Pavilion p6-2117cPC

    How can I remove the DVD SuperMulti burner on my Pavilion?

  • Bateria Energia

    MEU tem uma mensagem netbook no icon da bateria: "Conectado mas sem carregar. Netbook nao works sem o cabo. SE o cabo ele desliga puxo. O what to do? ELE acaba voltar da assistencia tecnica apos ter comprado a little tempo. Faith trocado o HD Grato.

  • Como fazer meu ip address

    Como fazer meu ip address