Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to access a function from a global function

New Here ,
Nov 09, 2016 Nov 09, 2016

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

980
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 09, 2016 Nov 09, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 09, 2016 Nov 09, 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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 09, 2016 Nov 09, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 10, 2016 Nov 10, 2016

No I can't find a solution to my problem...

I can't access images/symbols from a self-defined function...

Still this error: Javascript error in event handler! Event Type = element

Greetings,

Marco

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 10, 2016 Nov 10, 2016
LATEST

look, either sym and sym.$("etc..) are undefined (most likely) or only sym.$("Etc...) is undefined.  which is it?

if it's both, you've lost a reference to sym.  because you had a reference to it somewhere else in your project, you can continue debugging by tracking what's changed to cause you to lose that reference.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2016 Nov 09, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 09, 2016 Nov 09, 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 09, 2016 Nov 09, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 10, 2016 Nov 10, 2016

Hello!

I am using Adobe Edge Animate 2015 CC

Still problems and I am not able to find it 😞

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines