PDA

View Full Version : Make new page


Raindog26
03-16-2006, 08:42 AM
Hi
Is it possible by action script to make a new page in a project?

yosik
03-16-2006, 09:07 AM
No.
New object, yes, but not new page.

Yossi

Raindog26
03-16-2006, 09:17 AM
Ok
thanks for your reply.

TJ_Tigger
03-16-2006, 09:37 AM
You can have action script create a new page in another project that is in the design phase, but not a project that has been compiled. One cool thing is you can now get the action script for a page and set the action script for a page as well. With these actions, you could have a blank page in your project that you could build anyway you wanted through action script. It is just that the page would have to exist when the project was compiled.

Tigg

TJS
03-16-2006, 10:22 AM
That's a great idea Tigger... you'd have one page in your project that is effectively a "shape-shifter" that gets rebuilt anytime you need based on any number of external scripts.

Raindog26
03-17-2006, 12:57 AM
Just great.
It was just that I was looking for.
I want to build a wizard for making new projects.
So happy now.
But I guess I will be hara asking allot on the way :D
Thanks allot

Raindog26
03-17-2006, 01:06 AM
Now I need help from you TJ Tigger.
How do I start?

TJ_Tigger
03-17-2006, 07:31 AM
Now I need help from you TJ Tigger.
How do I start?

What are you wanting to do? I see that you want to have a project wizard, but is this design time, or run time. If it is design time, I would suggest looking in the examples forum, I have a couple of projects posted there that have code for reading the XML file for IR projects. Look for the XML parser and the IR Project CodeViewer.

Tigg

TJS
03-17-2006, 08:19 AM
You'll want to familiarize yourself with the actions related to creating and manipulating objects. The help file is very good!

Here are some (but not all) of the important ones:

Page.CreateObject()
Page.SetObjectScript()
Page.EnumerateObject()
Page.GetObjectType()
Page.DeleteObject()
Button.SetProperties() (every object type has a set properties action... you'll need to know these well.)

Here's a sample implementation:
1. Create a new project with one blank page. Add this to the On Show script:
Application.RunScriptFile("AutoPlay\\Scripts\\StartupScript.lua");

2. Create a new text file. Open the new file with notepad and put the following in it:

-- Set the properties for the exit button
t_ExitButtonProps = {};
t_ExitButtonProps.ButtonFile = "AutoPlay\\Buttons\\button.btn";
t_ExitButtonProps.Text = "EXIT";
t_ExitButtonProps.ObjectName = "btn_Exit";
t_ExitButtonProps.X = 10;
t_ExitButtonProps.Y = 10;

-- Create the exit button
Page.CreateObject(OBJECT_BUTTON, "btn_Exit", t_ExitButtonProps);

-- Add functionality to the new button
Page.SetObjectScript("btn_Exit", "On Click", "Application.Exit();");


3. Save you new text file as "StartupScript.lua" in the AutoPlay\Scripts\ folder of your project.

4. Make sure that the "button.btn" file or whatever .btn file you decide to use exists in the AutoPlay\Buttons\ folder of your project.

5. Preview or build and run the app to see how it works. You should get a blank page with an exit button in the top left corner that closes the app when pressed.

Your imagination is the limit from here...

Roboblue
03-17-2006, 11:07 AM
hmmmm.... interesting.
giving the user a page to input some parameters that would write variables to txt (lua) file, then page jumping and have the user see the changes they've made. This could give interactivity to the project.
The wheels are turning, now
thanx guys.

TJS
03-17-2006, 11:21 AM
"Hello user! Where would you like me to put this Input Object?"

Roboblue
03-17-2006, 11:26 AM
I was actually thinking of using this in a product catalog. If the customer would like to see a variation on a product that is unique, you could offer more choices without loading up the project with examples.
Or a simple room designer, Logo designer, landscaping choices, etc. I don't know how complex you could get, but it is something I would like to explore "when I get a roundtuit", or the time, whichever comes first.

TJS
03-17-2006, 11:38 AM
Just kidding...

This would also work well if you wanted to build a "content management" application to allow non-tech users to prepare updates for your AMS apps... that one is worth $$$!

Raindog26
03-20-2006, 06:46 AM
This looks just great.
I will look into this now and try to get there I want to get.
Thank you all.

bule
03-20-2006, 09:04 AM
It's like building APMS inside APMS... LOL!