Nanoparticle Project: Difference between revisions
No edit summary (change visibility) |
No edit summary (change visibility) |
||
| Line 1: | Line 1: | ||
Nanoparticle Synthesis Project is one of the NSF funded Nano-Technology related projects, in Binghamton University-SUNY/Mechanical Engineering Department. |
|||
This particular project is a joint project between Mechanical Engineering and Computer Science Departments. |
|||
This page is designed to be a ''Knowledge Transfer'' page for anyone interested to upgrade this project, or work on another project with similar requirements. |
|||
==Introduction to NSS== |
==Introduction to NSS== |
||
Nanoparticle Synthesis Simulator (NSS) is designed to be educational tool about a particular experiment, namely synthesizing Silver Nanoparticles via redox reaction. |
|||
The chemicals used in the actual experiment are: |
|||
*'''Liquid medium/Solvent:''' Toulene |
|||
*'''Metal Salt:''' Silver Acetate |
|||
*'''Reducing Agent:''' Tetrabutylammonium Borohydride |
|||
*'''Surfactant/Capping agent:''' Dodecylamine |
|||
Where Nanoparticle size depends on temperature, concentration of reactants, time and the surfactant used in the experiment. |
|||
The simulation tries to mimic the real laboratory synthesis experiment, allowing the users to interact with the lab setting with virtual beakers, flasks, etc. |
|||
The target audience of the simulation is college freshmen and high school students. |
|||
== |
==Macromedia Flash 8 w/ ActionScript 2.0 in NSS== |
||
===Introduction to Flash=== |
===Introduction to Flash=== |
||
Flash is designed to be |
|||
===Library=== |
===Library=== |
||
Library panel on the right hand side of the Flash environment is also very important. It serves as the container of all the symbols used in the project. |
|||
Unlike other applications such as "Microsoft Visual Studio", Library in Flash is project/file specific. So the library contains only those symbols used in |
|||
===ActionScript as a Scripting Language=== |
|||
the corresponding flash file. |
|||
In order to add something to the library: |
|||
====Common Libraries==== |
|||
===ActionScript 2.0 as a Scripting Language=== |
|||
====Timeline Control==== |
====Timeline Control==== |
||
Common ActionScript 2.0 commands for timeline control include: |
|||
====Browser/Network==== |
|||
*gotoAndPlay(frameNumber); |
|||
====Variables==== |
|||
*gotoAndStop(frameNumber); |
|||
*play(); |
|||
*stop(); |
|||
====Browser/Network Control==== |
|||
A very common browser control command is: |
|||
*getURL(URL,window,method); |
|||
*getURL(URL,window); |
|||
It allows the user to redirect to an URL using some form of interaction such as a button. The "window" parameter decides in which window the URL should be |
|||
connected to. "0" lets the user redirect from the current page to the URL, whereas a "1" opens up the URL in another window/tab. |
|||
Another comment that might be useful is: |
|||
*loadVariablesNum(fileName, window,method); |
|||
which allows the user to pass variables from the flash file to a server side scripting language. |
|||
In NSS it is used to pass variables to a PHP file, which in turn sends out emails. It uses the following code: |
|||
loadVariablesNum("emailer.php", 0,"POST"); |
|||
The "emailer.php" file in turn takes the variables and uses the following code to send out emails: |
|||
<?$subject = $_POST["subject"]; |
|||
$message = $_POST["message"]; |
|||
$header = "From: nssquizresults@gmail.com\n"; |
|||
$header .= "Reply-To: nssquizresults@gmail.com\n"; |
|||
$header .= "X-Mailer: PHP/" . phpversion() . "\n"; |
|||
$header .= "X-Priority: 1"; |
|||
mail("nanoparticlesynthesissimulator@gmail.com", $subject, $message, $header);?> |
|||
====Variables in Flash==== |
|||
===Timeline=== |
===Timeline=== |
||
Timeline is the single most important window in the flash environment no matter which version is used. |
|||
===Basic Tools=== |
===Basic Tools=== |
||
| Line 27: | Line 87: | ||
VariableName.text = "This is a text!"; |
VariableName.text = "This is a text!"; |
||
===Common Libraries=== |
|||
===Components=== |
===Components=== |
||
Pressing Ctrl+F11 in Flash will open up the components window. This set of elements contain most of the GUI elements that are needed for user input. |
Pressing Ctrl+F11 in Flash will open up the components window. This set of elements contain most of the GUI elements that are needed for user input. |
||
===Drag/Drop Effect=== |
|||
===Drag/Drop Animation=== |
|||
Drag and Drop animation can be achieved with the following code template: |
|||
//instanceNameOfObject is place holder for the actual variable name of the object to be dragged and dropped |
|||
//instanceNameOfTarget is place holder for the actual variable name of the target object defining the correct area for a drop |
|||
//"_x" and "_y" are coordinate properties of the abject |
|||
//oldSpotX and oldSpotY are place holders for the objects old coordinates |
|||
onMouseMove = function () { |
|||
updateAfterEvent(); |
|||
}; |
|||
instanceNameOfObject.onPress = function() { |
|||
this.startDrag(); |
|||
}; |
|||
instanceNameOfObject.onRelease = function() { |
|||
this.stopDrag(); |
|||
checkTarget(this); |
|||
}; |
|||
instanceNameOfObject.onReleaseOutside = function() { |
|||
this.stopDrag(); |
|||
checkTarget(this); |
|||
}; |
|||
function checkTarget(drag) { |
|||
if (drag.hitTest(instanceNameOfTarget)) { |
|||
// do whatever you want i.e: gotoAndStop(2); |
|||
} else { |
|||
instanceNameOfObject._x = oldSpotX; |
|||
instanceNameOfObject._y = oldSpotY; |
|||
} |
|||
} |
|||
===Importing Video Files to Flash=== |
===Importing Video Files to Flash=== |
||
===Current Time=== |
===Current Time=== |
||
In order to get the current time in flash.. |
|||
===Embedding Flash Filese into HTML Pages=== |
|||
== |
==ProEngineer in NSS== |
||
===3-D Animations using ProEngineer=== |
===3-D Animations using ProEngineer=== |
||
How to produce 3-D animations using ProE.. |
How to produce 3-D animations using ProE.. |
||
Revision as of 15:05, 7 May 2009
Nanoparticle Synthesis Project is one of the NSF funded Nano-Technology related projects, in Binghamton University-SUNY/Mechanical Engineering Department.
This particular project is a joint project between Mechanical Engineering and Computer Science Departments.
This page is designed to be a Knowledge Transfer page for anyone interested to upgrade this project, or work on another project with similar requirements.
Introduction to NSS
Nanoparticle Synthesis Simulator (NSS) is designed to be educational tool about a particular experiment, namely synthesizing Silver Nanoparticles via redox reaction.
The chemicals used in the actual experiment are:
- Liquid medium/Solvent: Toulene
- Metal Salt: Silver Acetate
- Reducing Agent: Tetrabutylammonium Borohydride
- Surfactant/Capping agent: Dodecylamine
Where Nanoparticle size depends on temperature, concentration of reactants, time and the surfactant used in the experiment.
The simulation tries to mimic the real laboratory synthesis experiment, allowing the users to interact with the lab setting with virtual beakers, flasks, etc.
The target audience of the simulation is college freshmen and high school students.
Macromedia Flash 8 w/ ActionScript 2.0 in NSS
Introduction to Flash
Flash is designed to be
Library
Library panel on the right hand side of the Flash environment is also very important. It serves as the container of all the symbols used in the project.
Unlike other applications such as "Microsoft Visual Studio", Library in Flash is project/file specific. So the library contains only those symbols used in
the corresponding flash file.
In order to add something to the library:
Common Libraries
ActionScript 2.0 as a Scripting Language
Timeline Control
Common ActionScript 2.0 commands for timeline control include:
- gotoAndPlay(frameNumber);
- gotoAndStop(frameNumber);
- play();
- stop();
Browser/Network Control
A very common browser control command is:
- getURL(URL,window,method);
- getURL(URL,window);
It allows the user to redirect to an URL using some form of interaction such as a button. The "window" parameter decides in which window the URL should be
connected to. "0" lets the user redirect from the current page to the URL, whereas a "1" opens up the URL in another window/tab.
Another comment that might be useful is:
- loadVariablesNum(fileName, window,method);
which allows the user to pass variables from the flash file to a server side scripting language. In NSS it is used to pass variables to a PHP file, which in turn sends out emails. It uses the following code:
loadVariablesNum("emailer.php", 0,"POST");
The "emailer.php" file in turn takes the variables and uses the following code to send out emails:
<?$subject = $_POST["subject"];
$message = $_POST["message"];
$header = "From: nssquizresults@gmail.com\n";
$header .= "Reply-To: nssquizresults@gmail.com\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";
mail("nanoparticlesynthesissimulator@gmail.com", $subject, $message, $header);?>
Variables in Flash
Timeline
Timeline is the single most important window in the flash environment no matter which version is used.
Basic Tools
Text Tool
The important fact regarding this tool is that it's type can be one of the following:
- Static Text
- Dynamic Text
- Input Text
Depending on the type it will act differently. A static text, as its name suggests, cannot be changed during the play of the flash animation. A dynamic text on the other hand can be manipulated by accessing its "text" property.
VariableName.text = "This is a text!";
Components
Pressing Ctrl+F11 in Flash will open up the components window. This set of elements contain most of the GUI elements that are needed for user input.
Drag/Drop Animation
Drag and Drop animation can be achieved with the following code template:
//instanceNameOfObject is place holder for the actual variable name of the object to be dragged and dropped
//instanceNameOfTarget is place holder for the actual variable name of the target object defining the correct area for a drop
//"_x" and "_y" are coordinate properties of the abject
//oldSpotX and oldSpotY are place holders for the objects old coordinates
onMouseMove = function () {
updateAfterEvent();
};
instanceNameOfObject.onPress = function() {
this.startDrag();
};
instanceNameOfObject.onRelease = function() {
this.stopDrag();
checkTarget(this);
};
instanceNameOfObject.onReleaseOutside = function() {
this.stopDrag();
checkTarget(this);
};
function checkTarget(drag) {
if (drag.hitTest(instanceNameOfTarget)) {
// do whatever you want i.e: gotoAndStop(2);
} else {
instanceNameOfObject._x = oldSpotX;
instanceNameOfObject._y = oldSpotY;
}
}
Importing Video Files to Flash
Current Time
In order to get the current time in flash..
Embedding Flash Filese into HTML Pages
ProEngineer in NSS
3-D Animations using ProEngineer
How to produce 3-D animations using ProE..