Skip to main content
marcoc84408541
Participant
November 9, 2016
Question

How to access a function from a global function

  • November 9, 2016
  • 3 replies
  • 1106 views

Hi All!

I have a set of symbols which has to be turned off at a specific click...

There for I created on top of the code a global function, like this:

function hideSymbols()

{

  console.log("inside hideSymbols");

   sym.$("Stage_hoofdVraag1").hide();

  console.log("Job done!");

}

There is a symbol called: "hoofdVraag1", I am able to turn it on and off in an event handler but not in a global function.

The function hideSymbols prints the message correct and after that I get the error: Javascript error in event handler! Event Type = element

What am I doing wrong?

Thanks in advance!

Greetings,

Marco

    This topic has been closed for replies.

    3 replies

    just.emma
    Inspiring
    November 9, 2016

    Are you using Edge Animate or Animate CC (formerly Flash Pro)?

    marcoc84408541
    Participant
    November 10, 2016

    Hello!

    I am using Adobe Edge Animate 2015 CC

    Still problems and I am not able to find it :-(

    Legend
    November 9, 2016

    Just glancing at your code, my first instinct is that what you're doing wrong is trying to use jQuery to control CreateJS. But there's not enough context given to say that for certain.

    marcoc84408541
    Participant
    November 9, 2016

    Okay  I will try again to explain...

    I have a lot of images one of them is called: "hoofdVraag1"...

    Those images has to be turned on and off during runtime...

    I want to make a global function which has to do that...

    In the evenhandler I use this: sym.$("hoofdVraag1").hide();

    That works!

    Now I want to do the same in the globalfunction...

    Now my question... How to call that function? I can't figure it out...

    Do I need to convert that image into a symbol?

    Greetings and thanks!

    kglad
    Community Expert
    Community Expert
    November 9, 2016

    use console.log to see if sym and sym.$(etc) are defined.

    marcoc84408541
    Participant
    November 9, 2016

    Same error... But that's not strange... If I can't access it from normal code, I also can't access it via console.log/alert functions...

    I think I am calling the function on the wrong way... I allready tried many things like:

    document.getElementById("Stage_hoofdVraag1").hide();

    But nothing worked...

    kglad
    Community Expert
    Community Expert
    November 9, 2016

    you should have been able to pinpoint your error with those two log statements.  which is it?