i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger image. my problem is i have captions to go with it and when i try to load the captions nothing happens or can be seen to be happening.
i dont know where i am going wrong as i have no output or compiled errors -
-
-
var locVar = new Array();
-
locVar = imgLoc.split(",");
-
trace ( locVar );
-
-
var tmbVar = new Array();
-
tmbVar = tmbLoc.split(",");
-
trace ( tmbVar );
-
-
var capVar = new Array();
-
capVar = imgCap.split(",");
-
trace ( capVar );
-
-
var NPICS:Number = locVar.length; // number of pictures to load
-
var PICX:Number = 32.8; // x loc of big picture
-
var PICY:Number = 24.9; // y loc
-
var THUMBHOLDERX:Number = 50; // x location of thumbnail holder movieclip
-
var THUMBHOLDERY:Number = 457; // y location
-
var THUMBW:Number = 100; // width of each thumbnail
-
var THUMBH:Number = 75; // height
-
var MARGIN:Number = 10; // margin between thumbnails
-
var TOTALBYTES:Number = 212000; // approx sum of bytes in all jpgs (x 2)
-
var MAXPIXELS:Number = 12; // max number of pixels to move slider per frame
-
-
// mask definition; mask is assumed to cover some part of the thumbnail slider (here the numbers
-
// were chosen so that there are margins between the mask and the right and left edges of the movie
-
// (which is 420 x 290), and enough space above and below the thumbs to show them when they 'grow'
-
// on mouseover
-
var MASKX:Number = 0; // start x location of mask
-
var MASKW:Number = 600; // mask width
-
var MASKY:Number = 447.9; // start y location of mask
-
var MASKH:Number = 92; // mask height
-
-
var totalloaded:Number = 0; // running tally of bytes loaded from all pics
-
-
// index into pictures array, used for loading
-
var ipic:Number;
-
-
// set up loader, an instance of MovieClipLoader
-
var loader:MovieClipLoader = new MovieClipLoader();
-
-
// use the main timeline to listen to and respond to loader's broadcast events
-
loader.addListener(this);
-
-
// function to move thumbnail slider ("this" = thumbs_mc)
-
-
function sliderControl() {
-
var w:Number = this._width/2;
-
var hw:Number = mask_mc._width/2;
-
var npixels:Number;
-
// only do when mouse over slider mask
-
if (_ymouse > mask_mc._y && _ymouse < mask_mc._y + mask_mc._height) {
-
// mouse over left half of slider:
-
if (_xmouse > mask_mc._x && _xmouse < mask_mc._x + hw) {
-
npixels = (hw - _xmouse) / hw * MAXPIXELS;
-
this._x += npixels;
-
if (this._x >= 0) this._x = this._x - w;
-
// mouse over right half of slider:
-
} else if (_xmouse > mask_mc._x + hw && _xmouse < mask_mc._x + mask_mc._width) {
-
npixels = (_xmouse - hw) / hw * MAXPIXELS;
-
this._x -= npixels;
-
if (this._x <= -w) this._x = this._x + w;
-
}
-
}
-
}
-
-
// thumbnail click (onrelease) handler
-
-
function openPic() {
-
pic_mc.loadMovie(locVar[this.i]);
-
}
-
-
function brightON(){
-
this._alpha = 300;
-
}
-
function brightOFF(){
-
this._alpha = 30;
-
}
-
function captionTXT(){
-
_root.cap_txt = capVar;
-
}
-
-
// assign event handlers (called when all jpgs are loaded)
-
-
function setupHandlers() {
-
pct_txt.removeTextField(); // don't need loading indicator any more
-
thumbs_mc.onEnterFrame = sliderControl;
-
for (var i:Number = 0; i < NPICS*2; i++) {
-
thumbs_mc["mc"+i].onRollOver = brightON;
-
thumbs_mc["mc"+i].onRollOut = brightOFF;
-
thumbs_mc["mc"+i].onMouseDown = captionTXT;
-
thumbs_mc["mc"+i].onRelease = openPic;
-
}
-
}
-
-
// listener function for broadcast 'done' message (for each pic)
-
// onLoadInit gets executed when the movieclip has been loaded into _mc AND
-
// its width and height data are available.
-
// (_mc = the movieclip being loaded into)
-
// this routine sets the size and position of each thumbnail clip as its jpg
-
// is loaded and starts the next one loading. When all have been loaded,
-
// a random picture is loaded into pic_mc and setupHandlers is called to
-
// assign handlers to each thumbnail movieclip
-
-
function onLoadInit(_mc:MovieClip) {
-
// this gets done when the jpg is completely loaded:
-
_mc._width = THUMBW;
-
_mc._height = THUMBH;
-
_mc._alpha = 30; // for image clarity
-
// give the movieclip a property to remind it who it is
-
// (used by openPic to know which big picture to open)
-
_mc.i = (ipic >= NPICS ? ipic-NPICS : ipic);
-
-
// add picture size to totalloaded variable
-
totalloaded += loader.getProgress(_mc).bytesTotal;
-
-
// now load the next one (if there are more) or set up handlers if done
-
ipic++;
-
if (ipic == NPICS * 2) {
-
// start with a random photo displayed when all thumbs loaded
-
pic_mc.loadMovie(locVar[Math.floor(Math.random()*NPICS)]);
-
setupHandlers();
-
} else if (ipic >= NPICS) {
-
// load jpg into duplicate thumbnail (will already be cached)
-
loader.loadClip(tmbVar[ipic-NPICS], thumbs_mc["mc"+ipic]);
-
} else {
-
// load jpg into thumbnail
-
loader.loadClip(tmbVar[ipic], thumbs_mc["mc"+ipic]);
-
}
-
}
-
-
// listener function to handle broadcast progress messages
-
// make pct_txt show cumulative loading progress
-
-
function onLoadProgress(_mc:MovieClip, loaded:Number) {
-
var loadedsofar:Number = totalloaded + loaded;
-
pct_txt.text = Math.floor(loadedsofar / TOTALBYTES * 100) + "%";
-
}
-
-
function init() {
-
// create holder for pictures
-
createEmptyMovieClip("pic_mc", 1);
-
pic_mc._x = PICX;
-
pic_mc._y = PICY;
-
-
// create (and draw) holder for thumbnails
-
createEmptyMovieClip("thumbs_mc", 2);
-
thumbs_mc.beginFill(0, 100); // black
-
thumbs_mc.moveTo(0, 0);
-
thumbs_mc.lineTo(2 * (MARGIN + THUMBW) * NPICS, 0);
-
thumbs_mc.lineTo(2 * (MARGIN + THUMBW) * NPICS, THUMBH);
-
thumbs_mc.lineTo(0, THUMBH);
-
thumbs_mc.endFill();
-
// drawing the thumb holder at 0, 0 and then moving it makes its reg point = upper left
-
thumbs_mc._x = THUMBHOLDERX;
-
thumbs_mc._y = THUMBHOLDERY;
-
-
// create, draw and enable mask over thumbs (could use different variables to define mask
-
// if desired)
-
createEmptyMovieClip("mask_mc", 3);
-
mask_mc.beginFill(0x0000cc, 100);
-
mask_mc.moveTo(0, 0);
-
mask_mc.lineTo(MASKW, 0);
-
mask_mc.lineTo(MASKW, MASKH);
-
mask_mc.lineTo(0, MASKH);
-
mask_mc.endFill();
-
mask_mc._x = MASKX;
-
mask_mc._y = MASKY;
-
thumbs_mc.setMask(mask_mc);
-
-
// create loading textfield indicator
-
createTextField("pct_txt", 4, 200, 100, 40, 100);
-
var tf:TextFormat = new TextFormat();
-
tf.align = "center";
-
tf.size = 12;
-
tf.font = "Verdana";
-
tf.color = 0xFFFF00;
-
pct_txt.setNewTextFormat(tf);
-
-
// create loading textfield indicator
-
createTextField("cap_txt", 0, 400, 200, 40, 100);
-
var cf:TextFormat = new TextFormat();
-
cf.align = "center";
-
cf.size = 12;
-
cf.font = "Verdana";
-
cf.color = 0xFFFF00;
-
cap_txt.setNewTextFormat(cf);
-
-
// make empty movieclips in thumbs_mc for each pic to go into
-
// make double the number so the slider can move continuously and show content
-
for (var i:Number = 0; i < NPICS * 2; i++) {
-
var mc:MovieClip = thumbs_mc.createEmptyMovieClip("mc"+i, i+1);
-
mc._x = i*(MARGIN + THUMBW);
-
mc._y = 0;
-
}
-
-
// set the pointer to the first jpg in the array picnames
-
ipic = 0;
-
// start loading jpgs (ipic is initialized to 0)
-
loader.loadClip(locVar[ipic], thumbs_mc["mc"+ipic]);
-
}
-
-
init();
-
stop();
-
1 3645
ok i've solved my problem to get captions to be shown but im having a problem with looping.....
is anybody able to help me with as 2? i dont feel like writing a long post if no-one is actually going to reply so if anyone can help ill post after you replied......th anks in advance, its much appreciated
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: CB US 77 |
last post by:
I use a piece of javascript to create a photo gallery slideshow. The
slideshow part works great, but I would like to add captions to each
picture. If you want to see the html, send me an email to
usb15@cox.net.
Any help would be great.
|
by: Stian Lund |
last post by:
Hello,
I've been struggling with this problem for a while now, so I though I'd
get some input from anyone more skilled with CSS than I am.
I'm actually trying to accomplish two things with this:
1. Create a floated image with text around, with a caption centered
underneath. Image size can be varied but the caption needs to have a
fixed size to make it break correctly I think. I also need the image to
resize automatically when the...
|
by: Eric Diana |
last post by:
Hello,
Im trying to create a dynamic array of textboxes from an array
returned by a web service. THe web service returns a list of fields
that I need to place on a dynamically created web page. The problem I
am having is when the button event is clicked, the text typed in the
textbox doesn't get saved with the textbox. I might be way off base
with even trying this. If anyone could give me some idea on what is
going wrong or another...
|
by: paolazi |
last post by:
Hello I have a problem: I have a database(mysql) with the following fields:
test, descr, title
I want to display them into a flash file.
Now my php file called list.php (which collect the information from my database) is the following:
<?php
include_once '../library/config.php';
include_once '../library/opendb.php';
$query =mysql_query("SELECT * FROM `$table` ORDER BY(`title`DESC ");
|
by: Dionysusmtl |
last post by:
I'm working on a flash portfolio that loads examples of our work (jpgs) into a movie.
For example, it started off using an xml list to display certain images but I found it necessary to draw info from the database and pass some variables in the querystring to change the source of the images in the movie depending on which client is clicked.
Here is the problem.
I have tweaked the code and it should work fine - and sometimes it does. ...
| |
by: gabrielk43 |
last post by:
Hi I am new to Flex and I use Flex Builder 2 to make a web service client. So I have a web service in .NET(c#) with a simple web method that returns a string(no arguments). It works, I tested it using firefox. I have managed to consume the service in Flex by using MXML like this:
<mx:WebService id="wsTestWebService" wsdl="http://localhost:3521/AjaxControlToolkitWebSite2/TestFlexService.asmx?wsdl"showBusyCursor="true"...
|
by: shaqa |
last post by:
I try to do this but i cannot.
i creat two layers with actionscript seperated as slideshow need to be,,and i try to put in one rectangle all of my images but cannot put in work,it doesnt load when i go to my choosen page.
Below is the script,please any one tell me how to put all of my images to one rectangle which later i can resize it,and load the image slideshow when i open choosen page.
script:
layer proto:
MovieClip.prototype.alpha =...
|
by: saijin |
last post by:
I've been trying to implement simple lines of XML into my flash file created with ActionScript 3.0, but things seem not to be working.
All I want to do is to load an external XML file (data.xml), and output the content which are inside the <project text="content to show"></project> tags into a scripted text field.
Here are what I've been doing so far:
var txtFldPassage:TextField = new TextField();
txtFldPassage.multiline =...
|
by: nathj |
last post by:
Hi,
Well the title of the thread is the question. I have tried searching for this and after several days of getting nowhere with it I decided I would ask.
So here's the deal. I am using Flash 8, I have a movie that reads information from an XML file. The trick is that depending on a selection on my web page I want the move to read a different XML file. This sounds simple enough right?
I thought so, pass the variables over to the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |