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

How can I access my Text Field from Flash with ActionScript in Flash Builder 3.0?

Community Beginner ,
Jul 14, 2013 Jul 14, 2013

I have a Movie Clip in Flash that contains two text fields with the instance names: "petName and description"

I've got a superclass, "Animal", with three subclasses: Piggy, Goat, and Puppy.

I've tried doing this: (where "buddy" is and instance of "Puppy")

buddy.description.text = "Hello world.";

... but I keep getting the error, "Access of undefined property petName through a reference with static type "puppy".

Here's my code:

-----> Animal Class: http://pastebin.com/cTve8spB

-----> Puppy Sub-Class: http://pastebin.com/VcPNDkAi

-----> Main File: http://pastebin.com/nTsPM7ve

Basically, I have a text bubble that has two text fields inside of it. One is the name, the other is the description. The name is "petName" and the description is "description". (There is also _petName, which is a different variable in my code that I'm using to actually store the name, "Buddy," etc.)

The "Animal" class extends "BubbleBase" (the base graphic for my speech bubble), and the Puppy class extends Animal... so I'm not sure why I'm not able to access the text fields.

*Note: I ended up changing in flash the instance names from "petName and description" to "myName and myText" to be a little bit easier to distinguish. But even if I do:

buddy.myText.text = "Hello world.";

... I don't see the option for "myText" available in the autocomplete when I'm writing my coe.

Thank you for your help!

-Liz

Can no one seriously help on the Adobe forums? If no one can help, can someone please point me to a paid professional who'd be willing to help me figure out my problem?

TOPICS
ActionScript
447
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 ,
Jul 14, 2013 Jul 14, 2013
LATEST

cast buddy as a Puppy:

Puppy(buddy).description.text="hello world";

p.s.  if you state your issue clearly, and especially if you pinpoint the problem, you almost certainly will be helped free of charge in the adobe forums. 

but, if you are in a rush or, you have a complex problem and especially if you require source (fla and/or as) files to be corrected, you almost certainly should consider hiring someone to help.  you can hire me via my website (http://www.kglad.com)

thank you for understanding,

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