Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by djkr · Mar 09, 2012 at 02:10 PM · javascriptobjectunity 3.5

'text' is not a member of 'OBJECT' JavaScript Not Working in Unity 3.5 - Lost Commands?

Hi, I've taken an older project and inserted it into Unity 3.5 (from 3.4), and it appears that many of the commands for checking web content No Longer Work...? I keep getting "'text' is not a member of 'OBJECT'" or "'error' is not a member of 'OBJECT'", etc...

There are over 200 errors - so here is just one example... of the .TEXT and .ERROR Not Working...

CAN YOU TELL ME WHAT THE NEW VERSIONS OF THESE ARE OR WHAT I SHOULD PUT:

Example using: .TEXT .ERROR

(The earlier part of this script loads a button graphic... then this script load the link the button should visit - hence its waiting to get back the .text from the WWWeb - of the link for the button - so when the user presses the button - it visits the correct web page)

 function checkforbuttonlink0() {    
 linkb0 = "http://mywebsite.com/sendsback-a-buttons-weblink--script.php?buttonnumber="+button+"&id="+for-account;
 
     //  Check if it exists
        link0_b = WWW(linkb0);
 
       // Wait/Load
       yield link0_b;     
 
     linkimb0 = (link0_b.text);
     yield linkimb0;     
     
     //  Error check
     if (link0_b.error){
         TextHints.message = "ERROR (CHECK INTERNET CONNECTION)";
         TextHints.textOn = true;
         eerr0 = 1;
     //Dont Instantiate
 
     }
         
     if (linkimb0 == ""){
                 eerr0 = 1;
     //Dont Instantiate
     //nothin
     } 
               if (linkimb0.length > 100){
                 eerr0 = 1;
     //Dont Instantiate
     //nothin
     } 
      
      ////print"eerr0 is:"+eerr0);
     
     if (eerr0 == 0) { 
       //////print"NEW - I found >>"+linkimb+"<< so I loaded a button - eerr is:"+eerr);
      
     if (linkimb0 != "error"){
 
      buttonstore.load0 = linkimb0;
 
        }
 
     }
      
      
 }


NOTE : Having the same problem with the .length javascript Command - "..is not a member of 'OBJECT'"

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image djkr · Mar 12, 2012 at 09:16 AM 0
Share

Stil having troubles in some areas...

Could you give me a snippet/ example from my text above as to the correct way?

Especially:

    linkimb0 = (link0_b.text);
     yield linkimb0;    
 
     //  Error check
     if (link0_b.error){
        TextHints.message = "ERROR (CHEC$$anonymous$$ INTERNET CONNECTION)";
        TextHints.textOn = true;
        eerr0 = 1;
     //Dont Instantiate
 
     }
 
     if (linkimb0 == ""){
           eerr0 = 1;
     //Dont Instantiate
     //nothin
     } 


$$anonymous$$uch appreciated...

$$anonymous$$

avatar image djkr · Mar 12, 2012 at 09:40 AM 0
Share

Also... if it wasn't clear - my apologies.. at the start of the script above - I declared all variables similar to this ($$anonymous$$us any #pragma... commands):

var linkimb0; var link0_b; var eerr0 : int;

...etc. $$anonymous$$

avatar image syclamoth · Mar 12, 2012 at 09:42 AM 1
Share

Yes, as per Eric's answer, it's pretty obvous from the error you're getting that you haven't declared the types of all your variables. We already know what the problem is- all you need to do is manually declare the types of all your variables, not just some of them!

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Eric5h5 · Mar 09, 2012 at 03:05 PM

There are no missing commands; "not a member of Object" means you're trying to use dynamic typing with #pragma strict, which is not allowed. So remove all dynamic typing.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image by0log1c · Mar 09, 2012 at 03:42 PM 0
Share

Exactly, the 3.5 compiler is simply a little more strict by default. either type your objects correctly or add the #pragma implicit/#pragma downcast - I forget which.

avatar image Eric5h5 · Mar 09, 2012 at 04:21 PM 0
Share

No, the compiler isn't any more strict, it's just that JS script templates include #pragma strict by default in 3.5. This can be removed if desired (but probably shouldn't be in most cases). Also, adding #pragma implicit/downcast will not remove the "no dynamic typing" rule of #pragma strict. #pragma implicit allows variables to be declared without "var", and the only thing #pragma downcast does is remove the warning if you downcast, it doesn't actually change anything.

avatar image by0log1c · Mar 09, 2012 at 04:42 PM 0
Share

Right, I hate to debate against 53k of knowledge, hehe. I agree about the #pragma strict - which makes the compiler more strict, yet I'm pretty sure that when I was using JS and #strict, I've had to use the #downcast to compensate for that exact situation (IE: inspector's enum) but my memory might be playing tricks on me, sorry.

avatar image
0

Answer by djkr · Mar 13, 2012 at 04:25 AM

Awesome... It's starting to work... very simply just declaring my var TYPE first... OK... This is great!

Thanks very much!!!!! You guys are amazing!

For anyone reading - THE ANSWER WAS basiially:

DO THIS (AFTER...But you first need to tell it what the variable will be [var x : String, Int, WWW, etc] )

 linkb0 = "http://mywebsite.com/sendsback-a-buttons-weblink--script.php?buttonnumber="+button+"&id="+for-account;
 
     //  Check if it exists
      link0_b = WWW(linkb0);
 
     // Wait/Load
     yield link0_b;   
 
     linkimb0 = (link0_b.text);
     yield linkimb0;    

YOU MUST FIRST STATE THIS AT THE TOP:

 var linkb0 : WWW;
 var  link0_b : WWW;
 var linkimb0 : String;

..very simple...LoLz... Thanks Again...! K

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Disable GameObject Only Father Not Children 2 Answers

Setting a variable to an instantiated object. 1 Answer

touch 3d object open gui 1 Answer

Drawing a 3D object javascipt 0 Answers

Object won't collide with Player unless Player is moving 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges