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

Why can't I call play(); in another class?

New Here ,
May 01, 2015 May 01, 2015

code1.PNGcode2.PNGcode3.PNG

So I have made a game, with a dinosaur, and when you bite into something I want there to be bloodsplatter. I've animated the bloodsplatter and the first image is the Class for it. But when I press space It wont change, I can only trace words in the splash function. The other images are snippets from the dinosaur class. Help is very much appreciated, because I am quite new to AS3.

TOPICS
ActionScript
291
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 ,
May 01, 2015 May 01, 2015

that will cause the your blood instance to play.  if that's what you want, use the trace function to confirm that if-branch is executing and splash() is executing.

p.s. your not following naming convention which will cause more and more problems if you ever work with anyone else or continue to seek help from others.

your class name should be BloodClass and your instance blood.  you have just the opposite.

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 ,
May 01, 2015 May 01, 2015

when I put a trace in splash() it works, but it wont play when I put play(); there

why is that?

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 ,
May 01, 2015 May 01, 2015

you may have lost scope.  use the trace function, eg

trace(this)

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 ,
May 01, 2015 May 01, 2015

still won't play, I've tried so many things but I can only play it from inside the class.

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 ,
May 01, 2015 May 01, 2015

what's the trace show?

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 ,
May 01, 2015 May 01, 2015

[object blood]

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 ,
May 01, 2015 May 01, 2015
LATEST

again, use the trace to continue debugging.

eg, start an enterframe loop that checks your instances currentFrame property.

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