This is continued lesson from last week. See this lesson and learn how to create XML slideshow using Actionscript.
Step 4: Create XML Slideshow Using Actionscript
Select the empty keyframe in your Actions layer. Press F9 to display your Actions panel. Copy and paste all of the following code into your Actions panel:

Firstly, you need to have the code for loading your XML file. In the first line, I set the variable myXML equal to this.firstChild. Then, I declare the variables image and description as array. To track the number of images, you need to set the value of the variable total equal to the total length of the number of childNodes of XML file contains. Then, I use a for loop to cycle through each childNode which contains image and caption attributes in the image and description arrays.

Create Slideshow function here:
(more…)
|
No Comments »
This week I will teach you how to create a simple XML slideshow in Flash using ActionScript. The advantage of using XML is you no need to change, add, edit or delete images in your FLA file. All you need to do is just update your images and description in the XML file. Besides, you also can control the speed of the slideshow.
XML Flash Slideshow Tutorial
Step1: Prepare Your Images
You can try to prepare all images with same width and height (optional). You can save your images in JPG, GIF, and PNG format into the images folder. Make sure that your images size must not too heavy because it may takes time for flash preloader to load your images if size is larger.

Step 2: Add Images To XML
(more…)
|
4 Comments »
In this tutorial you will learn how to scroll the image from left to right and vice versa by clicking and holding down the scroll buttons.

This setup uses a <div> tag with a picture inside. The image is sized 100 x 100 pixels for each; the division viewpoint is set to 210 x 120 pixels. You need to set overflow:hidden in order to hide all images and horizontal scrollbar to be displayed.
When a button is pressed and held down, either function ScrollLeft() or ScrollRight() is called to start a timer and scroll the division by +4 or -4 pixels every 5 milliseconds. When the button is released, you need to clear the timer in order to prevent the division to be continued scrolling.
Works Fine In All Web Browser
I have tested this on IE7, Opera, Safari and Firefox 3.0 on PC and it works great. IE6 will have little problem on the image button issue, there will have border appear on the image if the image is used for linking purpose, it is inside anchor tag <a>…</a>.
My Coding Part
(more…)
|
6 Comments »
The below example is rotating image links on a timer. Each image link will be changed after every 5 seconds. This basic script is to allow you to save space or just to make your page a little bit interesting. You can use this method to display ads at any timing options that you need.
My code can support sequential or random rotation. You can specify its own url for each image link.
Images of varying dimensions can be included in the rotation. If you want to display your image dimension, then you just go to set the width and height of
tag.
<body onLoad=”rotateImage(’rImage’, ‘link’)”>
<center>
<a id=”rLink”><img id=”rImage” width=150 height=150>
</a> <!– You can set your dimension of image –>
</center>
</body>
(more…)
|
1 Comment »
This week, you can learn how to calculate the percentage value for each poll option that you have chosen. The percentage value is computed based on this formula:

So, you can create another file named Poll_Display.php
Then create a function to show your poll question and options. Let say your function is named ShowPoll()
function ShowPoll() {
$poll = Poll::GetPollQuestion();
$vote = Poll::GetUserVote($poll->qst_id,CurrentUser::$userid);
if ( $vote ) {
showResultPage();//if voted before, just show poll result page
}
else {
if ($_POST["submit"] == “Submit”) {
$choice = (intval(substr($_POST["Vote"], 3, 1))); //use intval to convert string value to int value
if ($_POST["Vote"] == “opt$choice“) {
$v = Poll::UserVoteOption(CurrentUser::$userid,$poll->qst_id,$choice);
$r = Poll::IncreasePollAnswerCount($poll->qst_id, $choice);
showResultPage();
}
}
else {
showQuestion();
}
}
}
Next, you need to create showResultPage() and showQuestion()
(more…)
|
No Comments »