-
[CS3] DataGrid Component, XML & Hyperlink question
Hi,
I am very new to flash and am just winging it here to update parts of our existing html site to flash (using CS3, AS3, FMPro 8). This is a multi part question!
We have a timeline that lists our projects, etc, and when clicked on goes to several pages of pictures:
http://www.mikesmithstudio.com/projects/0.htm
I have already created a flash 'timeline' by customizing the datagrid component and linking it to an xml file that was created from filemaker pro 8. I have played around with a version of a photo album movie that allows me to click through a series of pictures based on a text file.
The main question i have now is how to link the datagrid to the photo album.
As in, when i click on a project, it goes to the correct series of pictures.
Is their a way to 'dynamically' create the link, i.e. when someone presses on a certain project it goes to the correct series of pictures depending on what the 'record_no' is? (i have also created a 'record no' field in filemaker/xml so that i can store each series of pictures in a folder with that number, i.e. folder 65 would contain 1.jpg, 2.jpg, 3.jpg....)
Should the series of pictures be a seperate movie or contained in the same file as the datagrid?
ALSO:
for some reason 3 or 4 blank rows appear at the top of my datagrid, is their any way to get rid of these?
below are the codes i've used:
PHP Code:
import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;
import fl.data.DataProvider;
var colorTextFormat:TextFormat = new TextFormat();
colorTextFormat.color = 0xFFFFFF;
var dp:DataProvider;
var c1:DataGridColumn = new DataGridColumn("PROJECT");
c1.width = 190;
var c2:DataGridColumn = new DataGridColumn("ARTIST");
c2.width = 110;
var c3:DataGridColumn = new DataGridColumn("INTERACTION");
c3.width = 130;
var c4:DataGridColumn = new DataGridColumn("YEAR");
c4.width = 40;
var projects_dg:DataGrid = new DataGrid();
projects_dg.setStyle("headerTextFormat", colorTextFormat);
projects_dg.setRendererStyle("textFormat", colorTextFormat);
projects_dg.addColumn(c1);
projects_dg.addColumn(c2);
projects_dg.addColumn(c3);
projects_dg.addColumn(c4);
projects_dg.resizableColumns = false;
projects_dg.sortableColumns = false;
projects_dg.setSize(500, 540);
projects_dg.setStyle("cellRenderer", CustomRowColors);
addChild(projects_dg);
var url:String = "/Users/08/Desktop/FLASH/as3 xml test/projectsdata.xml";
var req:URLRequest = new URLRequest(url);
var uLdr:URLLoader = new URLLoader();
uLdr.addEventListener(Event.COMPLETE, completeHandler);
uLdr.load(req);
function completeHandler(event:Event):void {
var ldr:URLLoader = event.currentTarget as URLLoader;
var xmlDP:XML = new XML(ldr.data);
xmlDP.ignoreWhite = true;
var dp = new DataProvider(xmlDP);
projects_dg.dataProvider = dp;
}
and part of the xml file (i've also created a field that calculates the path to the folder of images called 'url'):
<?xml version="1.0" encoding="UTF-8" ?><!-- This grammar has been deprecated - use FMPXMLRESULT instead -->
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ERRORCODE>0</ERRORCODE>
<DATABASE>MSSWEB.fp7</DATABASE>
<LAYOUT/>
<ROW MODID="1" RECORDID="2">
<PROJECT>Channel Four Big 4 </PROJECT>
<ARTIST>Freestate </ARTIST>
<INTERACTION/>
<YEAR>2007</YEAR>
<record_no>65</record_no>
<url>/Users/08/Desktop/FLASH/as3 xml test/65</url>
</ROW>
<ROW MODID="1" RECORDID="3">
<PROJECT>Luc and Ludivine get married </PROJECT>
<ARTIST>Julian Opie </ARTIST>
<INTERACTION/>
<YEAR>2007</YEAR>
<record_no>64</record_no>
<url>/Users/08/Desktop/FLASH/as3 xml test/64</url>
</ROW>
the code for the photo album:
PHP Code:
//we use the LoadVars to load the external text file data that contains the images
//number and urls
var text_lv = new LoadVars();
text_lv.load("65images.txt");
//refer the parent of the object in a property so we can access some function that
//the parent have and inaccessible by the text_lv object.
text_lv.parent = this;
//we use the MovieClipLoader so we can determine the width and height of the
//loaded image so we can perform our animation.
var img_mcl = new MovieClipLoader();
var handler = new Object();
var pos = 1;
handler.ref = imageContainer_mc.imgbg_mc;
//functions-----------------------
handler.onLoadInit = function(target_mc) {
//center the loaded image.
target_mc._x = -target_mc._width/2;
target_mc._y = -target_mc._height/2
//initialize the _alpha to 0 so we can animate the fade in effect.
target_mc._alpha = 0;
//this function will be explained later.
tween(this.ref, mx.transitions.easing.Regular.easeOut, "_width", this.ref._width, target_mc._width+10, .5, true);
tween(this.ref, mx.transitions.easing.Regular.easeOut, "_height", this.ref._height, target_mc._height+10, .5, true, _root, "finish");
};
handler.onLoadComplete = function(target_mc) {
//do nothing.
trace("image loaded");
};
text_lv.onLoad = function(success) {
if (success) {
trace("text loaded");
this.parent.loadImage(text_lv["img1"]);
} else {
trace("loadin failed");
}
};
//this function is used to load an image in the imageContainer_mc.holder_mc
//clip
function loadImage(path:String) {
img_mcl.addListener(handler);
img_mcl.loadClip(path, this.imageContainer_mc.holder_mc);
}
& the text for the photo album:
num=7&img1=65/1.jpg&img2=65/2.jpg&img3=65/3.jpg&img4=65/4.jpg&img5=65/5.jpg&img6=65/6.jpg&img7=65/7.jpg
any advice much appreciated!
*k
-
Thanks for sharing! https://ufo3d.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|