Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi all, for the sake of development and my personal usability I'd like to include external js scripts within the "External Javascript" CC function. CC does an amazing job - handling it through W.I.N.E is sometimes a bit of a challenge. Some UI elements are a bit funky. I did the following for editing "longer" scripts outside of the CC scope. create a js file "test.js" with some custom code and add it to the "external javascript" behaviour: var loadScript = document.createElement("script"); // create a script DOM node loadScript.src = "test.js"; // set its src to the provided URL document.head.appendChild(loadScript); This way you can switch between browser and text editor back and forth instead of fizzling inside the small CC JS window; opening and closing them to reach the publish button. If anyone got further useful insights of how to work better/faster/cleaner please share it - many thanks. |
||||
|
Sound good to me. I do something similar in that I put almost all my js code into a single Behavior. Different blocks of code run at different speeds (ms) for better performance within this one Behavior. I found this method works very well and I can even edit my code and add stuff without even opening CC sometimes until ready for testing later on, so I am not constantly test publishing as much as before now. All I have to do is to open the ccb file and refresh Actions and Behaviors and save for it to update before testing. I never use the default CC javascript boxes anymore as too slow and not good for bug finding... At the moment use NotePad++ for the code editor then sometimes will drop it into a online validator to check for errors..(I wish NotePad++ would have its own validator). |
||||
|
@Robo how do you control the speed of your "blocks"? I'm not a coder perse; so any hint is always a big thing for me :) I guess by "blocks" you're referring to different functions? |
||||
|
By blocks I just mean different sections. Funny you ask as I just made a video and its uploading right now that shows more about this - take a look: https://youtu.be/Pzm5ElAXZZ4 |
||||
|
ps - you don't have to worry about anyone accessing your code if its all in the one Behavior as there is a way to hide it inside CopperCube that wont allow for it to be taken out again...just use the same name of the default Behavior "behavior_2DJumpNRun" , once loaded into CC then delete it and budda boom - no access allowed...keep multiple backups first though.. |
||||
|
@Niko should forbid coppercube automatically create a behavior file when open a ccb project. I think it should’ve be difficult? |
||||
|
@Robo - awesome level in CC, thanks for sharing your thoughts. Keep up the good work. |
|