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 heaversm · Jun 13, 2012 at 04:20 PM · iphonevariablefunctionitween

iTween - calling functions on oncomplete doesn't work if the function is declared as a variable

Hi - so I have a weird catch22 happening - I'm trying to build a game for iPhone in javascript. iPhone requires that you declare your functions as variables (I think), like this:

 var myFunction = function(){ };

but in order for iTween's "oncomplete" functionality to work, the function must be declared like this:

 function myFunction(){ };

How do I get these two things to play nicely together. This is what one of my itween functions looks like:

 iTween.MoveTo(lighter,{"y":-.8, "z":-.4, "time":1,"easeType": "easeInOutQuad","oncomplete":"lighterEnable"});
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Wolfram · Jun 13, 2012 at 04:27 PM

Your assumption is not correct. Maybe you're accidentally trying to do something with "myFunction" in your code that's not allowed for functions, and since your "fix" removes the compiler warning, it seems like it is correct.

Can you show us and/or check for yourself the script/the places where you use/access "myFunction" (or referring to your iTween problem, "lighterEnable")? There must be a problem there (e.g., forgot the "()" when calling it, assigning it to something, ...)

Comment
Add comment · Show 2 · 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 heaversm · Jun 13, 2012 at 04:33 PM 0
Share

You're right - the assumption was an issue resulting from my previous issue, which you solved - I was not accurately referencing the script properly by casting its type. I will delete this quesiton if you remove your answer (or I can just accept this as the answer). Regardless, thank you for your help!

avatar image Wolfram · Jun 13, 2012 at 04:37 PM 0
Share

No need to delete valid questions, this is a knowledge database, so in case somebody stumbles over a similar problem at some point, this might help him. Feel free to accept this answer, as it did solve your question ;-)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Networking,State synchronize variable and function 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

build for iphone - "function is not a member of object" 1 Answer

Error on my javascript code 1 Answer

Ball not going to directions 0 Answers


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