Binding events to nested symbols from an Array

Hello all,
     I have a pretty solid foundation in flash and actionscript and am trying to recreate some of my projects in EA.
I want to bind mouseover, mouseout, and click events to eight nested symbols using a for loop. I am not sure if I have the syntax correct.
I was experimenting with the following code in compostionReady
var clipArray = new Array("A","B","C","D2","E","F","G","H");
function init() {
          for (var i=0;i<clipArray.length;i++) {
          var tempClip = clipArray[i];
          sym.getSymbol("Model2").$(tempClip).mouseover(function(){
                 sym.getSymbol("Model2").getSymbol(tempClip).stop("start")
          sym.getSymbol("Model2").$(tempClip).mouseout(function(){
                  sym.getSymbol("Model2").getSymbol(tempClip).stop(0)
init();
The code seems to run but every symbols' rollover only affects the last element of the array. So if I rollover A-G, symbol H with stop at "start". If I change the order in the array, it is always the last symbol affected.
Thanks for any help you can give
Craig

Thanks Resdesign for your helpful example. I am going to adapt it to my needs

Similar Messages

  • Refering nested symbols in array?

    How do I reference, in an array,  symbols that are nested inside another symbol? Do I have to use variables or something?

    Indeed, to get the current timeline position of a nested symbol, using an array, you could do this:
    // array
    var array_options = ["option1", "option2", "option3"];
    myFunc = function(){
         // get "myParentSymbol", then get this object (index 0 from "array_options"), nested inside "myParentSymbol"
         sym.getSymbol("myParentSymbol").getSymbol(array_options[0] ).getPosition();

  • Access a nested symbol timeline from the main stage

    Hi all,
    Would love some help on accessing a nested symbol from the main stage please.
    To set the scene.....
    "Its an autumn day..
    no sorry...just joking...
    So i have a symbol called "NormalAnatomy" - its not on the main stage, but when a button is clicked it appears in the 'content' box which is just a rectangle on the main stage.
    Inside "NormalAnatomy" symbol is another symbol called "Scrub_all" which is an animation
    For users to view the animation they use a scrub bar like this lovely lady has invented:
    Create Click and Touch Draggable Scrubbers with Edge Animate CC | sarahjustine.com
    So for Sarah Justines scrubber to work - the main stage has a lot of actions added to it. Also the "timelinePlay" symbol is on the main stage
    Its starts:
    var symDur = sym.getSymbol("timelinePlay").getDuration();
    var mySymbol = sym.getSymbol("timelinePlay");
    var scrubber = sym.$("scrubber");
    var bar = sym.$("bar");
    sym.$("mobileHit").hide();
    var dragme = false;
    So I put my "NormalAnatomy" symbol on my main stage to see if the code would work and changed all the relevant details.. and indeed it worked!
    var symDur = sym.getSymbol("NormalAnatomy").getSymbol("Scrub_all").getDuration();
    var mySymbol = sym.getSymbol("NormalAnatomy").getSymbol("Scrub_all");
    var scrubber = sym.getSymbol("NormalAnatomy").$("scrubber");
    var bar = sym.getSymbol("NormalAnatomy").$("bar");
    sym.getSymbol("NormalAnatomy").$("mobileHit").hide();
    var dragme = false;
    But i don't want the "NormalAnatomy" symbol to be on the main stage as I want it to appear in the 'content' box only when i hit a btn
    So as soon as I took this symbol off the main stage, the scrubber doesn't work. So I click a btn, and the symbol appears in the content box but the scrubber doesn't work.
    so I tried in front of the "NormalAnatomy"
    getStage().
    getStage("content").
    getComposition().getStage().
    getSymbol("content").
    but nothing works
    The main problem must be the fact that the NormalAnatomy symbol appears inside a content box so the MainStage actions doesn't know how to find it??
    So my question is... what should I put in the main stage actions to make it access the "NormalAnatomy" symbol?
    Thanks for your help in advance!

    On click handler for the symbol use
    sym.getComposition().getStage().getSymbol("nameofsymbol").play();
    or
    sym.getSymbol("nameofsymbol").play();
    replace the italics with the literal name of the symbol as it appears in the Elements panel.
    Some API details found here (http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html) in the Work With Symbols section.
    Darrell

  • Nested symbols assign to the same symbol created dynamically

    I would like to create nested categories from one symbols.
    I have got symbol called categories_sym
    I have parent symbol like this:
    I would like to create nested symbols from categories_sym asigned to cat_container executed from products_details_sym
    Here is my code
    And cosole from Firebug
    Is it possible to create nested symbol in the same symbol created dinamically?

    Yes, it's possible, but note that your child_container is actually a div and not a symbol.  (The icons are different between a symbol and a container.)
    I've created a sample that should give you a good idea of how this API works:
    http://adobe.ly/MlNIzd
    Hopefully the comments will help you figure out how to successfully use this API.
    Thanks,
    -Elaine

  • To display consecutive words from an array on a keypress. Event listeners not working.

    I need to display a series of words consecutively on a black background. A new word presented each time the Enter key is pressed (It is necessary that its the same key each time i.e the Enter Key). The words are arranged in an array. I have created a function for each Keypress and a listener. Also, as the previous word is replaced by the next, I have a removeChild() to get rid of the the last word.
    I have a removeEventListener set up also, to avoid any problems with the listeners. I have been at this a long time without sucess. It must be a listener problem (i.e I have not got the listeners focussed properly?) or a display problem. It only ever displays one word. Please see below code for the display of two of the words from the array which is called cvcwords. The main problem is that the words do not display one after the other (indeed not at all, except for the first one) when the enter key is pressed. Very much as a powerpoint presentation would, thats the idea anyway. I have just a sample of the code below. any help appreciated.
    var cvcwords : Array = ["bad", "mod", "hud", "mit", "sat", "fog", "puc",];
    this.stage.addEventListener(KeyboardEvent.KEY_DOWN, modKeyDown);
                                  function modKeyDown(e : KeyboardEvent) : void {
                                            if (e.keyCode == Keyboard.ENTER) {
                                                      removeChild(myText);               // to remove previous word from screen
                                                      myText.text = cvcwords[1];        //to display element one of the array
                                                      addChild(myText);
                                            } else if (e.keyCode == Keyboard.SPACE) { //this is for another seperate option
                                                      myText.text = "try again";
                                                      addChild(myText);
                   this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, modKeyDown);
                                  this.stage.addEventListener(KeyboardEvent.KEY_DOWN, hudKeyDown);
                                  function hudKeyDown(e : KeyboardEvent) : void {
                                            if (e.keyCode == Keyboard.ENTER) {
                                                      removeChild(myText);  //to remove previous word from the screen      
                                                      myText.text = cvcwords[2];
                                                      addChild(myText);
                                            } else if (e.keyCode == Keyboard.SPACE) {
                                                      myText.text = "do again";
                                                      addChild(myText);
                   this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, hudKeyDown);

    Based on what I see of your code, the following is all you might need...
    var cvcwords : Array = ["bad", "mod", "hud", "mit", "sat", "fog", "puc",];
    var counter:int = 0;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, modKeyDown);
    function modKeyDown(e : KeyboardEvent) : void {
        if (e.keyCode == Keyboard.ENTER) {
            myText.text = cvcwords[counter];      
            counter++;
        } else if (e.keyCode == Keyboard.SPACE) {
            myText.text = "try again";
            addChild(myText);
            stage.removeEventListener(KeyboardEvent.KEY_DOWN, modKeyDown);
    When you test this in Flash, in the player you need to be sure to select the Diable Keyboard Shortcuts option found under the Control option in the top toolbar
    If you really mean to have them try again, you probably do not want to remove the event listener

  • Adding mouse events to shapes painted from a shape array

    Hi,
    I currently paint shapes to a canvas from an array and want to be able to move these shapes around the screen. Unfortunately I am unsure how to set up the MouseDragged event so that it redraws only the shape I want (Currently there is no link in the paint method to the mouseDragged variables), any ideas?
    import java.awt.BasicStroke;
    import java.awt.Canvas;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Shape;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.Line2D;
    import java.awt.geom.Rectangle2D;
    import java.util.ArrayList;
    public class MyCanvas extends Canvas implements MouseMotionListener{
        private ArrayList liList;
        private ArrayList reList;
        private int rectX;
        private int rectY;
        int re;
        int li;
        public MyCanvas()
            Parser p = new Parser();
            liList = p.getLineArray();
            reList = p.getRectArray();
            addMouseMotionListener(this);
        public void paint(Graphics g)
            Graphics2D g2 = (Graphics2D)g;
            while(re<reList.size())
                Shape r = (Shape)reList.get(re);
                g2.setStroke(new BasicStroke(4));
                g2.setPaint(Color.blue);
                g2.fill(r);
                g2.draw(r);
                re++;
            while(li><liList.size())
                Shape l = (Shape)liList.get(li);
                g2.setStroke(new BasicStroke(4));
                g2.setPaint(Color.red);
                g2.fill(l);
                g2.draw(l);
                li++;
        public void mouseDragged(MouseEvent e)
            int rx = e.getX();
            int ry = e.getY();
            repaint();
        public void mouseMoved(MouseEvent e)
    }Cheers>

    why is that?Because event listeners work with components, and a Shape is no Component. Besides, I don't see any method to add a listener.

  • Adding mouse events to shapes painted from arrays

    Hi,
    I currently paint shapes to a canvas from an array and want to be able to move these shapes around the screen. Unfortunately I am unsure how to set up the MouseDragged event so that it redraws only the shape I want (Currently there is no link in the paint method to the mouseDragged variables), any ideas?
    import java.awt.BasicStroke;
    import java.awt.Canvas;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Shape;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.Line2D;
    import java.awt.geom.Rectangle2D;
    import java.util.ArrayList;
    public class MyCanvas extends Canvas implements MouseMotionListener{
        private ArrayList liList;
        private ArrayList reList;
        private int rectX;
        private int rectY;
        int re;
        int li;
        public MyCanvas()
            Parser p = new Parser();
            liList = p.getLineArray();
            reList = p.getRectArray();
            addMouseMotionListener(this);
        public void paint(Graphics g)
            Graphics2D g2 = (Graphics2D)g;
            while(re<reList.size())
                Shape r = (Shape)reList.get(re);
                g2.setStroke(new BasicStroke(4));
                g2.setPaint(Color.blue);
                g2.fill(r);
                g2.draw(r);
                re++;
            while(li<liList.size())
                Shape l = (Shape)liList.get(li);
                g2.setStroke(new BasicStroke(4));
                g2.setPaint(Color.red);
                g2.fill(l);
                g2.draw(l);
                li++;
        public void mouseDragged(MouseEvent e)
            int rx = e.getX();
            int ry = e.getY();
            repaint();
        public void mouseMoved(MouseEvent e)
    }Cheers

    why is that?Because event listeners work with components, and a Shape is no Component. Besides, I don't see any method to add a listener.

  • Issues animating symbol from another nested symbol instance

    Got quite the weird issue here regarding animating a symbol when mousing over and/or out of a symbol nested inside a symbol. You can see the example here. Rollover the word VISION. What happens is another symbol animates downward using JQuery's animate feature. Mousing out brings it back up.
    What's actually happening? The symbol at times animates up and down uncontrolably. It eventually stops, but not necessarily in the correct spot. Is it because of all the nesting? I'm trying to keep this as clean as possible which is why I'm nesting symbols. Much like I would a Flash comp way back when.
    Here's the mouseover code for btnVision:
    var myBtnVision = sym.getSymbol("btnVision");
    myBtnVision.play();
    try {
        var stage = sym.getComposition().getStage()
        stage.$("secVision").animate({top: 100}, { duration: 1000 });
    } catch (error) {
        if (console && console.error) console.error("An error occured: "+error.toString(), error);
    and here's the mouseout:
    var myBtnVision = sym.getSymbol("btnVision");
    myBtnVision.playReverse(500, false);
    try {
        var stage = sym.getComposition().getStage()
        stage.$("secVision").animate({top: 70}, { duration: 1000 });
    } catch (error) {
        if (console && console.error) console.error("An error occured: "+error.toString(), error);
    I have a dropbox file with the examples at the following:
    https://www.dropbox.com/s/ccgapo20p233h7z/rollover.zip

    Solved! It was just a little extra JQuery code that did the trick. Basically inserting a stop action.
    try {
        var stage = sym.getComposition().getStage()
        stage.$("secVision").stop().animate({top: 100}, { duration: 1000 });
    } catch (error) {
        if (console && console.error) console.error("An error occured: "+error.toString(), error);

  • Get the ID of a dynamically created symbol from library, INSIDE another symbol.

    Hi everyone,
    I'm trying to get the id from a dynamic created symbol from library.
    When dynamically creating the symbol directly on the stage (or composition level), there's no problem.
    But I just can't get it to work when creating the symbol inside another symbol. 
    Below some examples using both "getChildSymbols()" and "aSymbolInstances" 
    // USING "getChildSymbols()" ///////////////////////////////////////////////////////////////////////// 
    // ON THE STAGE 
    var m_item = sym.createChildSymbol("m_item","Stage");
    var symbolChildren = sym.getChildSymbols(); 
    console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
    // INSIDE ANOTHER SYMBOL
    var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement()); 
    var symbolChildren = sym.getSymbol("holder").getChildSymbols(); // Am i using this wrong maybe?
    console.log(symbolChildren.length) // returns 0 so can't get no ID either
    // USING "aSymbolInstances"" ////////////////////////////////////////////////////////////////////////// 
    // ON THE STAGE
    var m_item = sym.createChildSymbol("m_item","Stage"); 
    console.log(sym.aSymbolInstances[0]); // ok (i guess) x.fn.x.init[1] 0: div#eid_1391854141436
    // INSIDE ANOTHER SYMBOL
    var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
    console.log(sym.getSymbol("holder").aSymbolInstances[0]); // Javascript error in event handler! Event Type = element 
    In this post http://forums.adobe.com/message/5691824 is written: "mySym.aSymbolInstances will give you an array with all "names" when you create symbols"
    Could it be this only works on the stage/ composition level only and not inside a symbol? 
    The following methods to achieve the same are indeed possible, but i simply DON'T want to use them in this case:
    1) Storing a reference of the created symbol in an array and call it later by index.
    2) Giving the items an ID manually on creation and use document.getElementById() afterwards.
    I can't believe this isn't possible. I am probably missing something here.
    Forgive me I am a newbie using Adobe Edge!
    I really hope someone can help me out here.
    Anyway, thnx in advance people!
    Kind Regards,
    Lester.

    Hi,
    Thanks for the quick response!
    True this is also a possibility. But this method is almost the same of "Giving the items an ID manually on creation and use document.getElementById() afterwards".
    In this way (correct me if i'm wrong) you have to give it an unique ID yourself. In a (very) big project this isn't the most practical way.
    Although I know it is possible.
    Now when Edge creates a symbol dynamically on the Stage (or composition level) or inside another symbol it always gives the symbol an ID like "eid_1391853893203".
    I want to reuse this (unique) ID given by Edge after creation.
    If created on the stage directly you can get this ID very easy. Like this;
    var m_item = sym.createChildSymbol("m_item","Stage");
    var symbolChildren = sym.getChildSymbols(); 
    console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
    I want to do exactly the same when created INSIDE another symbol.
    var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
    Now how can I accomplish this? How can I get the Id of a dynamically created symbol INSIDE another symbol instead of created directly on the stage?
    This is what i'm after.
    Thnx in advance!

  • More syntax questions about nested symbols

    I have a symbol timeline that does everything I need it to do except to access a function within the stage symbol. I would have thought that calling the function in the stage symbol from a nested symbol (which is loaded dynamically, if that makes any difference) would be something along the lines of:
    sym.getComposition().getStage().gotoNextSlide("slide5");
    but no luck. I can alert the stage itself as [Object Object], which brings up another question. Is there an always-available property of objects that one can alert or trace to make sure the correct object is being targeted? I've had no luck with the symbol's id, name, or symbolName.

    Sure. You've seen one form of the project I'm working on, though I'm at the next speedbump. Here's an excerpt of the involved parts.
    I have the stage symbol and within that symbol, I have a function:
    function gotoSlide(slideName){
              fadeTo(slideName);
    function fadeTo(slideName){
         /// this all works fine, when called from the main timeline
    In the composition, I'm loading slides from the library and on the timeline of one of those slides is the following.
    navHidden = true;
    var trueButton = sym.getSymbol("answers").$("true");
    trueButton.bind('click',goNext);
    function goNext(){
              sym.getComposition().getStage().gotoSlide("slide_05");
    I know there are other syntaxes I could use but refactoring is in the future. The console log I get is:
    Object [object Object] has no method 'gotoSlide'
    It's slide 5 in these:

  • Multiple Nested Symbol Interaction

    I have 3 symbols that in certain scenarios need to comunicate to nested symbols within those 3, as well as possibly go to a frame within one of the nested.  All actions are currently on the stage.
    STAGE
    a_sym
    a1_sym
    b_sym
    b1_sym
    c_sym
    c1_sym
    frame label
    Example: From the STAGE, a_sym, a1_sym (a1_sym is  the button) when pressed should trigger action
    Back to the STAGE, c_sym, c1_sym, stop on frame label
    hammer.on("tap", function(event) {
                        sym.getSymbol("a_sym").getSymbol("a1_sym");
    So the part i'm having dificulty is where and how to place the action for the nested a1_sym to trigger the action to go 
    Back to the STAGE, c_sym, c1_sym, stop on frame label

    In this line the extra sym is totally wrong.
    sym.getSymbol("a_sym").getSymbol("a1_btn").sym.getComposition().getSta ge().getSymbol("c_sym").stop("frame_label");
    Everything is triggered from the stage! So, when you are in a symbol, you can access other symbols or their nexted symbols from the stage by returning to the stage with sym.getComposition().getStage(). This is actually the STAGE.
    Let's say you have on the stage:
    symbolA contains symbolB (a button)
    symbolC contains symbolD which has label1 and label 2.
    You can access label1 from symbolB with a click event on the button:
    sym.getComposition().getStage().getSymbol('symbolC').getSymbol('symbolD').stop('label1');
    or in compositionReady you could use:
    sym.getSymbol('symbolA').$('symbolB').click(function(){
         sym.getComposition().getStage().getSymbol('symbolC').getSymbol('symbolD').stop('label1');
    symbolB gets access to the stage: sym.getComposition().getStage()
    symbolB gets access to the other symbol's label: getSymbol('symbolC').getSymbol('symbolD').stop('label1');
    Anyway, here is a sample to demonstrate this: https://app.box.com/s/dqph10hq67rzur9yu9we

  • Get distinct values from plsql array

    Hi,
    I have declared a variable as below in plsql proc.
    type t_itemid is table of varchar2(10);
    inserted set of items in to this using a program
    now i want distinct values from that array how can i get it.

    I am using 9i so i cannot use set operator and more over my problem is that i am declaring the variable inside the plsql block . when i tried i am getting the below errors:
    SQL> r
    1 declare
    2 type t_type is table of varchar2(10);
    3 v_type t_type;
    4 begin
    5 v_type := t_type('toys','story','good','good','toys','story','dupe','dupe');
    6 for i in (select column_value from table(v_type)) loop
    7 dbms_output.put_line(i.column_value);
    8 end loop;
    9* end;
    for i in (select column_value from table(v_type)) loop
    ERROR at line 6:
    ORA-06550: line 6, column 41:
    PLS-00642: local collection types not allowed in SQL statements
    ORA-06550: line 6, column 35:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    ORA-06550: line 6, column 10:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 7, column 22:
    PLS-00364: loop index variable 'I' use is invalid
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored

  • Display one div at a time from an array?

    I am trying to make a multiple choice quiz. I have each question and answer in a div. There are 20 divs. All are set to not display on the stage, and I want to call one randomly to display as the user answers that question.
    For the moment, I am trying to get even one question to display on the stage. Here is my code, which is at the top in the edgeActions.js file inside the first function.
    //Edge code
    (function($, Edge, compId){
    var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes
    //my code
    var divs = new Array( 'div.ques1', 'div.ques2', 'div.ques3', 'div.ques4', 'div.ques5', 'div.ques6', 'div.ques7', 'div.ques8', 'div.ques9', 'div.ques10', 'div.ques11', 'div.ques12', 'div.ques13', 'div.ques14', 'div.ques15', 'div.ques16', 'div.ques17', 'div.ques18', 'div.ques19', 'div.ques20' ), idx;
    var idx = Math.floor(Math.random()*divs.length);
    function getQuestion() {
    //the following commands do not work
                        $('idx').show();
                        $('idx').css('display','inline');
                        $('divs[idx]').appendTo(document.body);
                        $('sym.que2').show();
      $('que2').show();
                        $('div.ques1').show();
                        $('ques2').show();
    //these do work
                        alert("blah");
                        console.log('this is working');
                        console.log('id=%d', idx);
              getQuestion();
    Since the console is returning the random number from the array, I have a feeling Edge cannot distinguish the array number from the corresponding div. Converting them to symbols does nothing. I am starting to think it would have been easier to just hand code this rather than using Edge.

    Hi Elaine,
    Thank you for your response!
    Your new randomize line worked beautifully
    I have tried defining my array elements in every connotation I can think of, inlcuding changing them to symbols. I did figure out today that an element has to be displayed before it will even be hit by jQuery, [.show() will not work] and if autoplay is checked while they are off, they will show, and vice versa. Confusing, but it narrowed it down enough for me to see I really just needed to figure out how to call the elements, then figure out all the on/off/autoplay stuff from there.
    Here is my new code in its new location, the compositionReady panel:
    var divs = new Array( 'Symbol_1', 'Symbol_2', 'Symbol_3', 'Symbol_4', 'Symbol_5', 'Symbol_6', 'Symbol_7', 'Symbol_8', 'Symbol_9', 'Symbol_10', 'Symbol_11', 'Symbol_12', 'Symbol_13', 'Symbol_14', 'Symbol_15',
    'Symbol_16', 'Symbol_17', 'Symbol_18', 'Symbol_19', 'Symbol_20' );   // display is on for all symbols
    sym.setVariable("myArr", divs);
    var random = Math.floor(Math.random() * 100) % 20;
    console.log( divs );   //works
    console.log( "myArr" );   //works
    console.log( random );    //works
    function getQuestion() {
             sym.$("myArr").hide();  // doesn't work
             sym.$("myArr").hide();  //doesn't work
                        console.log('this is working');  //works
                        console.log('id=%d', random);   //works
    getQuestion();
    All of the questions are showing at once and I want to be able to hide all of them.
    Array[20] 
    0: "Symbol_1"
    1: "Symbol_2"
    2: "Symbol_3"
    3: "Symbol_4"
    4: "Symbol_5"
    5: "Symbol_6"
    6: "Symbol_7"
    7: "Symbol_8"
    8: "Symbol_9"
    9: "Symbol_10"
    10: "Symbol_11"
    11: "Symbol_12"
    12: "Symbol_13"
    13: "Symbol_14"
    14: "Symbol_15"
    15: "Symbol_16"
    16: "Symbol_17"
    17: "Symbol_18"
    18: "Symbol_19"
    19: "Symbol_20"
    length: 20
    myArr
    17
    this is working
    17

  • Constructing a linked list from an array of integers

    How do I create a linked list from an array of 28 integers in a constructor? The array of integers can be of any value that we desire. However we must use that array to test and debug methods such as getFirst(), getLast(), etc...
    I also have a method int getPosition(int position) where its suppose to return an element at the specified position. However, I get an error that says cannot find symbol: variable data or method next()
    public int getPosition(int position){
         LinkedListIterator iter=new LinkedListIterator();
         Node previous=null;
         Node current=first;
         if(position==0)
         return current.data;
         while(iter.hasMore()){
         iter.next();
         if(position==1)
         return iter.data;
         iter.next();
         if(position==2)
         return iter.data;
         iter.next();
         if(position==3)
         return iter.data;
         iter.next();
         if(position==4)
         return iter.data;
         iter.next();
         if(position==5)
         return iter.data;
         iter.next();
         if(position==6)
         return iter.data;
         iter.next();
         if(position==7)
         return iter.data;
         iter.next();
         if(position==8)
         return iter.data;
         iter.next();
         if(position==9)
         return iter.data;
         iter.next();
         if(position==10)
         return iter.data;
         iter.next();
         if(position==11)
         return iter.data;
         iter.next();
         if(position==12)
         return iter.data;
         iter.next();
         if(position==13)
         return iter.data;
         iter.next();
         if(position==14)
         return iter.data;
         iter.next();
         if(position==15)
         return iter.data;
         iter.next();
         if(position==16)
         return iter.data;
         iter.next();
         if(position==17)
         return iter.data;
         iter.next();
         if(position==18)
         return iter.data;
         iter.next();
         if(position==19)
         return iter.data;
         iter.next();
         if(position==20)
         return iter.data;
         iter.next();
         if(position==21)
         return iter.data;
         iter.next();
         if(position==22)
         return iter.data;
         iter.next();
         if(position==23)
         return iter.data;
         iter.next();
         if(position==24)
         return iter.data;
         iter.next();
         if(position==25)
         return iter.data;
         iter.next();
         if(position==26)
         return iter.data;
         iter.next();
         if(position==27)
         return iter.data;
         iter.next();
         if(position==28)
         return iter.data;
         if(position>28 || position<0)
         throw new NoSuchElementException();
         }

    How do I create a linked list from an array of 28 integers
    in a constructor? In a LinkedList constructor? If you check the LinkedList class (google 'java LinkedList'), there is no constructor that accepts an integer array.
    In a constructor of your own class? Use a for loop to step through your array and use the LinkedList add() method to add the elements of your array to your LinkedList.
    I get an error that
    says cannot find symbol: variable data or method
    next()If you look at the LinkedListIterator class (google, wait for it...."java LinkedListIterator"), you will see there is no next() method. Instead, you typically do the following to get an iterator:
    LinkedList myLL = new LinkedList();
    Iterator iter = myLL.iterator();
    The Iterator class has a next() method.

  • Excel & ActiveX: Insert arbitrary columns from 2D array and create graph problems

    Hi there,
    I want to insert data from either a 1D or 2D array from LabView into Excel and create graphs.
    I used the information from the following example:
    http://www.ni.com/example/28934/en/
    and was able to create a new Excel file (I'm using Excel 2010), writing data from an 1D array to a column in excel by creating a while loop and using the first element of the array to write it to a specific cell. I use the counter of the loop to write to the next cell when the loop starts over and always delete the first value, which I write to the cell, from the array until it is empty.
    Now I also would like to write a 2D array - so the first column in Excel should be the first column from the array and so. Here I cannot use the loop counter directly as Excel only counts 1,2,... for the rows, but uses A,B,... to count columns. Also I do not know in advance how many columns my 2D array will contain, so creating a lookup table like (A means 1, B means 2,...) is not really an option (except there really is no other way). Is there a possibilty to convert numbers into letters or some way to 'explain' to the program that column 2 in the array means column B in Excel for example, or is there a way to insert new columns?
    I figured out how to add new Worksheets and as I also need to create a certain number of Worksheets and I know that on standard 3 sheets are present when creating the file, I use the 'add' methode to create every new worksheets before worksheet 3 - I could use the same methode to create new columns in Excel, but so far I didn't find a methode to do so. Or is there a way to enter the whole 2D array at once?
    Then I'd like to create a graph (in case of the 1D arrays a bar plot, when using 2D arrays a 3D plot) to view the data. I found this example:
    http://www.ni.com/newsletter/51339/en/
    -> as I do not have the toolkit I'd like to do it using ActiveX directly, so I tried to do things like shown under the headline 'DIY ActiveX/.NET'
    I tried to load the snippet to a new Excel file but got the error message 'microsoft.office.interop.excel.dll not found' and hence the code is not working. That confuses me a little as I would guess when this dll is not present I cannot access Excel from LabView at all, though my understanding of what I'm really doing so far is quiet limited. ;-)
    Also - as far as I understand from the snippet - when creating a new chart object I should be able the create methodes for it, however when I do a right click on the chart object of an ActiveX Worksheet symbol there are none listed.
    To explain my problems better I added a snippet showing my two problems: The inner of the two while loops shows how I import a 1D array. In the outer loop I seperate the columns. I know that currently this is not working as all data end up in column A of the Excel sheet - so I would need to convert the number of the outer counter to A, B,... or find a different solution.
    Moreover on the snippet I placed an ActiveX Worksheet Property with the Chart Object - as I can see the difference to the Chart Object in the example code from the last link above is the color. However I'm not sure what that means and how to change/ solve this.
    And just to make sure - I know this way the VI does not run as the Chart Object is placed completely wrong - I just did it, so it is included in the snippet.
    I'd be thankful for any suggestions,
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    ExcelAreaScan.png ‏60 KB

    Hello everyone and thanks for the answers.
    I only have the LabView Student Edition available here - is the toolkit included in it too. How can I check if it is installed/ available and in case it is installed - where can I find it?
    Today I had time to take a look at the example
    Create via ActiveX Labview a XY Scatter plot graph on an excel sheet
    It almost does what I want in terms of creating a graph. The only problem I could not fix, is that in this example a sheet is created where only the graph is present. i'd like to add the graph to a previously created worksheet. Today I tried get this working but it seems I stilll don't really understand what I'm doing, I'll post a snippet of my code as soon as I can access the PC with LabView on it again.
    I also took a look at the other example for inserting 2D attays - it seems to be what I need, I just had no time so far to test it, I'll post an update when I could test it.
    Thanks for the help so far!

Maybe you are looking for

  • JEditorPane printing a HTML PAGE

    Hi, Here is my problem. I am displaying a HTML Page in a JEditorPane. So far so good. when I try to print is printing to my printer. Here is the problem the Text or to say the font doesnot look good in the paper, each letter is not nice and smoth and

  • Granting object privileges to remote users.

    Hello, Here's the situation: I have 2 databases located on 2 different servers both running Win2k3. In the first database the main schema is M1 and it has to read objects on the another schema M2, located on the second database. I created a database

  • Printing a stack

    ok i've been working on a program for a couple of weeks and all I have left to do is print the stack. I'm pushing Grids as 2D arrays onto the stack and that part is working correctly (used the peek method) but when I try to print the entire stack it

  • Pixelated jerky render

    I have an hour and fifteen minute sequence that is comprised of slowed-down footage. I lowered the black levels with the Color Corrector Three way filter on all shots as well. When I render this sequence it comes out looking horrible - pixelated, lur

  • Best non-Airport Wireless Router

    Hi folks. Have a need for a brand new wireless router for an iPod 3, MacBook Air, and a potential iPhone 6 or maybe a 5C.  Airport is $99, and she's cheap, so I'm looking for some great alternatives.  Over the years I've had good and bad versions, an