Source language: Translate to:

How to load javascript

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

How to load javascript

Postby Just4Fun » Fri Jan 23, 2009 9:06 am

Hi there:

I'm moving to this section with my questions about javascript. My original question dealt with actions, but that has lead me to javascript.

Is there a relatively simple example of how to load javascript into a webbrowser object? If so, I can't find it. I'd like to see something with a literal and no variable. I'm trying to understand the process of loading the script and running it from an object.

I *think* that I need to create a blank .html page to have an address to use for the browser object. Then I have to call a javascript function into the object (a polygon). Not sure how to do this.

A VERY basic example would be so helpful? Sort of like:

1. do this
2. do that
3. do this
4.......

Thank you,

Rachel

PS. Are there any other newbies out there? Seems like I'm all alone here.
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA

Postby Just4Fun » Fri Jan 23, 2009 11:24 am

OK. I'm getting somewhere. I've figured out how to create and load javascript from within a webpage, but I still can't figure out how to call luis' function to transform.

1. Create web page
2. load javascript into html code.
3. ...?

-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA

Postby Neosoft Support » Fri Jan 23, 2009 11:24 am

The Polygon object doesn't have the capacity to execute JavaScript, so that's a dead end. However, the Web Browser object can be used to execute JavaScript with NeoBook's BrowserExecScript action. If you installed NeoBook from the CD, you will find a good JavaScript example in the following sample pub:

..\NeoBook 5\v5 Samples\Browser Communication\JavaScript Example.pub

Another JavaScript example can be found at the NeoBook Resource Center below:

http://www.neosoftware.com/neobook/modules/pubs/singlefile.php?cid=10&lid=35
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby beno » Fri Jan 23, 2009 6:42 pm

Oops!

I posted a reply in the Actions section before reading this new thread, and you are right: this is a better place to talk about this subject.. so let´s try to continue here...

PS. Are there any other newbies out there? Seems like I'm all alone here.


Nope, we all are newbies... somehow... :wink:

Added later:

Dave is right: it makes no sense trying to operate on a NeoBook object using javascript nor PFlash.

PFlash idea is complete playground to deal with drawings, images and multimedia stuff using Flash in a friendly manner.

I recommend it because luishp designed it with a very nice and friendly link with NeoBook.

So if you need a polygon inside PFlash you will have to draw it using PFlash code for drawings. Check the help file and post your code/questions here. Maybe we can work with it and get something nice.


beno
User avatar
beno
 
Posts: 678
Joined: Fri Apr 01, 2005 9:03 am
Location: México

Postby Just4Fun » Fri Jan 23, 2009 10:53 pm

Beno:

I think that both you and Neosoft are correct. I am on the wrong path. I need to figure out how to rotate my polygon object on its axis in the same way as transform.js that luishp created, but with DaveScript. Am I thinking correctly here?

I cannot use JavaScript unless it is within the webbrowser object. Is that right?

Thank you for all of your help.

-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA

Postby dpayer » Sat Jan 24, 2009 6:50 am

Just4Fun wrote:Beno:

I think that both you and Neosoft are correct. I am on the wrong path. I need to figure out how to rotate my polygon object on its axis in the same way as transform.js that luishp created, but with DaveScript. Am I thinking correctly here?

I cannot use JavaScript unless it is within the webbrowser object. Is that right?

Thank you for all of your help.

-Rachel


OK, lets recap here.

1) you want to rotate images/objects.
2) "DaveScript" does not do this directly
3) Objects (well pictures) can be rotated using Luis' flash project
4) Luis' program requires use of Webobject inside NB project.

One way of looking at this is, can you make a webbrowser object do what you want?

Remember, you can put a webbrowser object over the entire page and then put other things on top of it. In a sense you will not notice the webbrowser object but you can consider it a different type of canvas to put your object on top of. But, remember this: Objects put on top of a web browser object will likely block viewing of objects controlled within the webbrowser object. Example; you could have a webbrowser object 'canvas' over your page and still put a button on that page. But when you execute a rotation of an image in the webbrowser object and that image covers the location where the button is, that image will be behind the button (unless you disable the button or make it invisible before enacting the webbrowser/javascript action).

I think you are facing a problem many of us (who are modest 'programmers') have: when your only tool is a hammer, every problem appears like a kind of nail. Some nails are harder to hit than others though. Finding additional tools is helpful.

David P
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Gaev » Sat Jan 24, 2009 7:31 am

David P and others:
I think you are facing a problem many of us (who are modest 'programmers') have: when your only tool is a hammer, every problem appears like a kind of nail. Some nails are harder to hit than others though. Finding additional tools is helpful.
The PFlashAssist plugin was developed to address this very issue i.e. ... exploit the superior capabilities of Luis's PFlash swf/javascript combo ... without having to write a single line of Javascript code.

I believe Beno mentioned this in another post ... but it seemed to have been overlooked ... here ...

http://www.scriptedlogic.com/neoPLUGS1.htm

... is my website page for the plugin (co-authored with Hans-Peter) which translates simple (NeoBook style) plugin commands into Javascript that Luis's swf file requires ... comes with a Help file and sample pub that demonstrates the over 40 plugin commands you can use to ...

- populate the stage area with Text, Shapes and Images
- move, size and rotate these clips
- apply reflections, masks, bevels, drop shadows, blurs, glows and filters
- perform animations and distortions
- play sound and video files
- save stage areas to jpg or png files
- enable users to control clips with the mouse
- trigger NeoBook subroutines for various user actions
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby beno » Sat Jan 24, 2009 8:45 am

Hi Rachel,

I am curious: how would you like to rotate the object: using the mouse over it? or using a slider? ...?

Saludos,

beno
User avatar
beno
 
Posts: 678
Joined: Fri Apr 01, 2005 9:03 am
Location: México

Postby Just4Fun » Sat Jan 24, 2009 11:35 am

Hi Beno, & dpayer, et al:

You have all helped me to understand the situation and I appreciate it. Having the right tool for the job is essential.

Originally, I thought that I could either:

1. figure out how to use a formula that would address this issue. Maybe atan?

or

2. create many, many .png or .jpgs in various rotation positions and load each one when the user clicked on the object.

I would like to rotate a square object when the user clicks on it, however, if there is any other way to do this, I'd love to see how it would be done.

I like luishp's plug-in very much. It is perfect for what I would like to do. I am still interested in investigating it, but what I would most like to do is learn how to use Neobook before I use plugins. I know plugins will make life easier, but maybe I am a little more of a nail and hammer person. It gets confusing when I don't know the ins and outs of the development environment first. I really don't know what Neobook will and will not do yet because I am not a very good programmer. I will depend on all of you to tell me if I am trying to do something that can't be done. In fact, I would appreciate being told very much so that I wouldn't spend days trying.

I think that Neosoft felt that I could not rotate an object with a formula so maybe the only way to do all of this is within a web browser. If I am told that this cannot be done outside of the browser object, then I will try to learn the browser object better.

BTW Beno., Your English is MUCH better than my Spanish. LOL

-Rachel
May I never be cured of my curiosity! ;-)
User avatar
Just4Fun
 
Posts: 136
Joined: Sun Dec 14, 2008 10:05 am
Location: Western Washington, USA


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

cron