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 );

Tags: Illustrator

Similar Questions

  • Not fully functional mouse with MacBook Pro 2010. I can scroll up and down, but can not move the cursor.  The mouse works with my new Macbook 12. No mouse problem but Macbook Pro?

    Not fully functional mouse with MacBook Pro 2010. I can scroll up and down, but can not move the cursor.  The mouse works with my new Macbook 12. No mouse problem but Macbook Pro?

    What specific mouse?

  • Get this error on pages MuseJSAssert: error calling the function switch: TypeError: $(...). museMenu is not a function. Have read and did what I could find to solve problems.

    Hi I keep getting the error MuseJSAssert: error calling the function switch: TypeError: $(...). museMenu is not a function on my Web site which is not published, but I am downloading in British Colombia through muse.

    I'm on a PC.

    I tried export to HTML and still have the same problems locally.

    I saw that someone had a problem with mailchimp forms in one of a previous post. I removed the a widget of external source? for reservation and it was always happening.

    I created a new project like this and downloaded BC site all the files again to see if she could make a difference but still have the error.

    It's my URL BCdraft - home

    I tried to look at the site in the section "console" (where you can see the code of pages) to see if I could see the error that people had already advised but I get nothing... maybe not completely published because?

    I have reloaded the site through the muse in British Colombia with "all files" and is always the same.

    Here are some pictures that can help...

    Once on the home page, it may come with the error immediately or not... If you choose to say the title of the FAQ

    choose faq.png

    You must then (or choose other titles until it is) have this error coming...

    error.png

    Note that the title you have previously chosen as 'FAQ' now as 'price '.

    Changes to old title pricing.png

    This title is for some time and seems strange appears again.

    Here is a picture of scripts/css in the admin of BC as I've seen that this can be a problem but I don't know if this is normal or not and how to fix...

    cpanel.png

    I had taken a break from building the site for about a month and I had added on changes, but not them uploaded to the server just left saved on my PC.

    In the hope of an easy solution; p

    See you soon,.

    Steve.

    I published BC... what I wanted to say is that I did not live.

    Export HTML was to check if the error occurred in the HTML files locally.

    It ended up being a code of the external widget that was causing the problem. With him removed the pages work fine. (I had removed what I thought of them while troubleshooting, but I forgot to a separate embedded image)

    Specifically, it is because it was a pop-up overlay widget made for reservations. When I put it to then start a new page in the tab it works now. Seems that muse has changed to something allowing overlays?

    My thanks to Neha in support

  • 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.

  • I constantly get this pop-up, ' Exc in ev handl: TypeError: oSAPlg.oRoot.log is not a function. " What is the problem and how can I solve this problem?

    I received a lot of emails from trash and other deleted all my cookies and history. Now, I'm getting this pop-up and it is interfering with my use of the internet, ' Exc in ev handl: TypeError: oSAPlg.oRoot.log is not a function. " What is it and how can it be fixed, removed, managed to get rid of, etc. Thank you

    I've been working on what's wrong. She can do with McAfee Siteadvisor. I disabled suitable siteadvisor who never stopped popping up messages.

  • MuseJSAssert: Error calling the function switch: TypeError: $(...). toBrowserWidth is not a function only on Firefox Cookies are erased and problem not solved.

    Receive error message

    MuseJSAssert: Error calling the function switch: TypeError: $(...). toBrowserWidth is not a function

    only on Firefox

    for the url

    www.tx4you.com/index.html

    Please help

    browsererroroct2014.png

    Clear the cache of Firefox (no cookies). Preferences > advanced > cached Web Content click clean now. FWIW, loading the page just fine for me in Firefox.

  • 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

  • This just error message started appearing yesterday: Application JavaScript - TypeError: window CloseAlert not a function.

    Application of JavaScript - TypeError: window of the CloseAlert not a function.

    What causes this error, can you help me fix?

    I use Windows 7 and the latest browser Foxfire.

    • If you have many extensions then first turn on half of test extensions that half the problem.
    • Continue to divide the bad half that still has the question until you find that one is causing it.
  • I get this message. TypeError: PlacesUtils.nodeIsLivemarkContainer is not a function. Please help me with this.

    I get this POPUP error constantly. TypeError: PlacesUtils.nodeIsLivemarkContainer is not a function.

    It just started today and I had not had any problems until today.
    I tried to find an answer by searching and the only thing I found was something on 'ViewMarks' originally this problem BUT I didn't Viewmarks and don't know what it is.

    Hello

    The reset Firefox feature can solve a lot of problems in restaurant Firefox to its factory default condition while saving your vital information.
    Note: This will make you lose all the Extensions, open Web sites and preferences.

    To reset Firefox, perform the following steps:

    1. Go to Firefox > help > troubleshooting information.
    2. Click on the button 'Reset Firefox'.
    3. Firefox will close and reset. After Firefox is finished, it will display a window with the imported information. Click Finish.
    4. Firefox opens with all the default settings applied.

    Information can be found in the article Firefox Refresh - reset the settings and Add-ons .

    This solve your problems? Please report to us!

    Thank you.

  • typeError: L is not a function appears when I try to select an email to open

    whenever I try to open an email, or click one in the list I get typeError: L is not a function message. I tried the mouse and the mouse pad on my laptop and get the same result. It happens when I left-click with the mouse or the mouse pad.

    This problem may be caused by an extension that is not working properly.

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance).

    • Do not click on the reset button on the start safe mode window or make changes.

    If it works in Firefox Safe mode and then disable all extensions (Tools > Modules > Extensions) and then try to find out who is causing by allowing an extension at a time until the problem reappears.

    Close and restart Firefox after each change through "file > exit ' (Mac: ' Firefox > leave";) Linux: "file > exit ')

  • OnLoad error TypeError: TcFfUpdates.getTcPluginsInstance (.getNewExtensionsList) is not a function

    OnLoad error TypeError: TcFfUpdates.getTcPluginsInstance (.getNewExtensionsList) is not a function

    I get this message every time I select the firefox icon to open the program

    This problem may be caused by an extension that is not working properly.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Before the opening of Firefox, I get a window: application JavaScript Exc hand ev: TypeError: This.oRoot.enable is not a function. I have to click ok and then open Firefox

    I click on Firefox to open the browser.
    Browser does not open.
    I get a little window:
    (JavaScript application)
    EXC in hand ev: TypeError: This.oRoot.enable is not a function
    Ok
    I have to click OK and then the browser opens.
    How can I get away with this?
    I use 3.6.11
    Edition 6 created a lot of trouble with printing using Lexmark
    Help, please.

    This problem may be caused by the extension of McAfee Site Advisor

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Before you start, receive message "Exc in ev handl: this.» 0ROOT.enable is not a function", that mean

    Before start of Mozilla Firefox (MF) and after you press start, a
    message box appears on the screen:
    Message

                  Exc in ev handl:This .0root. enable is not a function
    

    When I press the MF button enter begins and everyhing seems to be
    works very well. MF will not start until I press the Enter key.
    Why! bold text

    Add-ons are the responsibility of their authors. McAfee does not yet have their extension on http://addons.mozilla.org that you had to install from their site.

    Disable the extension "McAfee Site Advisor" who has just updated 3.4.0 that probably out of block of addons list.

    • 'Ctrl + Shift + A' > find McAfee Site Advisor and use 'Disable', and then restart Firefox.
    • Do a Google search without problem
    • It seems that if you re - enable new Site Advisor and restart Firefox you agree. At least you know where to look if you get the error again, or research on Google to slow down.
  • EXC in ev handl: TypeError: this.oRoot.enable is not a function that is popping up when I befor I open my browser in a box pop up under the heading JAVA SCRIPT EXE. That is - what, how can I get rid of him?

    TypeError: this.oRoot.enable is not a function

    This is popping up when I befor I open my browser,in a pop up box under the heading JAVA SCRIPT EXE. What is it, how do I get rid of it?
    

    For me, this happened from disabling, but do not uninstall McAfee site Advisor. Recommend site completely uninstalled and the problem disappeared completely. I had turned off before site Advisor, but it seems after a update to McAfee, he was back and then turn it off again caused this problem.

    Go to "uninstall a program" or "add/remove programs" in control panel. Find McAfee in your list (McAfee total protection for me). Click it and then click "Uninstall/Change" (right there in XP, up above in Vista or 7). I don't remember exactly what you see after that, but at one screen I was given the choice to uninstall the McAfee total protection and/or the Site Adviser. You can just check the Site Adviser and just uninstall the Site Adviser while retaining the rest of the McAfee protection.
    

    Good luck!

  • New pop-up Javascript error, could not initialize dlwatch extension, oPref.addObserver is not a function. Stops new windows to launch. Help.

    Under Firefox 4 McabookPro, OS 10.6.7. When a new pop-up window open, which is necessary for some security applications, I get a Javascript error. It is said:

    [Javascript error]
    dlwatch (200)
    Could not initialize dlwatch extension
    TypeError: oPref.addObserver is not a function.

    It is a problem with the Video DownloadHelper extension.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the Add-ons is the cause of the problem (switch to the DEFAULT theme: Tools > Modules > appearance/themes).

    • Makes no changes on the start safe mode window.

    See:

Maybe you are looking for