Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




XML Data And Duplicating MCs For Gallery



Ok big question...how would i go about loading XML data in this format , <info><category></category> <subcategory></subcategory> <picture>http://img.</picture></info><info><category></category> <subcategory></subcategory> <picture>http://img.</picture></info> Then About 20 additional Infos like that. Now the whole xml list has the same tags. How would i go about displaying them in flash? I wanted to use one MC and have it duplicate for each info category and place the MCs on the stage so it looks like a gallery. Each MC would have a picture with some info on it loaded form the XML. I think i would need to use the Dataset but im not even sure how i would go about doing this.



Adobe > Flash Data Integration
Posted on: 01/12/2007 04:32:51 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Referencing Data Vs Duplicating Data
This is a question that keeps coming up for me, but I've never been able to find an adaquate answer. I'm probably not looking in the right places.

When setting properties of an object, what exactly is being stored: the location of the property or the actual information for that property? For example, if I have the following code:

_root.createEmptyMovieClip( "mcEmpty", 0 );

tarClip = mcEmpty;

What exactly is being stored in tarClip? Is it a string denoting the location of mcEmpty or some other reference to mcEmpty?

All I know is that for some objects (ie. arrays, strings, numbers) the actual data from one object is placed in the second resulting in two instances of the same information. Yet for other objects (ie. movieclips, xml nodes) a reference to the data seems to be placed in the inheriting object such that only one copy of the data exists.

So in general, my question comes down to the following: in what instances is information duplicated when one property is set equal to another and when is a reference to the information set? Is there a general rule for this?

Thanx for any help you can provide.

Duplicating MClips With XML Data Inside
hi,

i'll try to explain my due.

I've a MovieClip that contains some Dynamic textFields and I want to include in those textFields the values of Nodes of an external XML file..

Until here.... no problem...

The problem is that i want that that my SWF output creates a sortlist with all the nodes legth of my XML file..

So in the first frame of my movie a create the MovieClip width the TextFields above... and i did a rottine that duplicates that MovieClip several times... but i can't atribute the value of the diferent nodes to the such duplicated MovieClip...

in realy i want taht may SWF loads the XML information and dysplays that like a list...

thanks,

Duplicating Gallery, But Replacing Images?
I've got a website that has a gallery, I need additional galleries than the 1 it already has in it. 5 total, actually.

I'm just having a little trouble with duplicating it, and it actually working, anybody got any time to help?

Oh yeah, and thank you in advance!

New XML Data For Thumbnail Gallery
Hello everyone! I am trying to load new XML data in to the XML Thumbnail gallery that is explained on this site. When I click on a button, I want to replace the current loaded XML file with a new XML file. I can get Flash to load the new XML file, but I can't figure out how to replace the thumbails and image once the new XML file is loaded. Anyone have any suggestions.

Thanks!
wm

Flash (Photoshop) Web Gallery Data
I have created a web gallery using Photoshop CS2 to allow my clients to proof their images. From this gallery I want to allow them to flag images they like then submit the selections to me via email. Currently they are using the gallery just to view the images. There is not a way to mark the images or to submit them via email. The clients have to manually write down the file names, type and email, and send it to me.

1. Can the function of selection boxes be added to the web gallery? I do not own the full flash program.

2. Can the file names for the selected images be put into an email to me using a submit button?

How are both of these task performed?

Thanks

PreCache XML Loaded Data, Gallery
I got another XML gallery thrown at me this week and am thinking of adding a new feature.
When a user clicks on a gallery it will load the first image, and continue to load all of the images so they won't have to wait each time they hit next, as it would be in their cache.

this link has been thrown around a lot, but I don't think this feature (which is an awesome feature, oh yes) has been addressed.

http://www.manipulator.com/

Goto one of the galleries and wait for it to load, and then keep hitting next. The pictures load before you get there. You can catch up to the unloaded ones and reach a loader bar if you hit next enough times.

Anyone have an idea of how to implement this feature? This should be in every XML gallery, as it vastly improves user experience. People love to just hit next and see pictures immediately!

Using Bitmap Data Smooth In My Gallery
hi i want to use bitmap data smooth when loading my images
here is the function that loads the images , how can i implement bitmap data smooth to this?

Code:
function handleThumbRelease():Void {
var which:String = this._parent._name;
var num:Number = Number(which.substr(6));
thumbSelected = num;

if (!mainTL.large_mc) {
mainTL.attachMovie("large.box", "bgroundBox_mc", mainTL.getNextHighestDepth(), {_alpha:0, _x:Stage.width/2, _y:Stage.height/2, _width:Stage.width, _height:Stage.height});
mainTL.attachMovie("mc.large_image", "large_mc", mainTL.getNextHighestDepth(), {_visible:false, _x:Stage.width/2, _y:Stage.height/2});

mainTL.bgroundBox_mc.colorTo(0x000000, 0);
mainTL.bgroundBox_mc.alphaTo(80, 1, 'easeInOutSine');

mcl2.loadClip(dirPath + gallery_obj.imagePath + "/" + library_obj.image[num].path, mainTL.large_mc.holder);

enableThumbs(false);
enableButtons(false);
enableMainNav(false);

// mark as viewed
this.viewed = true;
this.alphaTo(35, 1, 'easeInOutSine');
this._parent.highlight.alphaTo(0, 1, 'easeOutExpo');
}
};
thanks

Adding Image Data To The Photo Gallery?
Hi,

The Kirupa Photo Gallery tutorial is great and I've used it to build a site...but I now need to try and get image data to display along with each photo ie. title etc.

Suggestions on how to do that? I'm thinking create another variable with each title in the same order as the appropriate photo variable and then using the index to move through each at the same time. But this seems just ugly and wish the tutorial had used an xml file...

Fed.

Adding Image Data To The Photo Gallery?
Hi,

The Kirupa Photo Gallery tutorial is great and I've used it to build a site...but I now need to try and get image data to display along with each photo ie. title etc.

Suggestions on how to do that? I'm thinking create another variable with each title in the same order as the appropriate photo variable and then using the index to move through each at the same time. But this seems just ugly and wish the tutorial had used an xml file...

Fed.

Mx.data.components - Unable To Declare Data Component Types In External Class Files
Hi all,

FlashMX 2004, v7.2:

I am trying to declare instances of data-components (DataSet and DataHolder) in external classfiles, but Flash can't find the sourcefiles for any of the data component classes in the classpath.

According to the help-files, the classname for the DataHolder component is:

Code:
mx.data.components.DataHolder


Similarly, the classname for the ComboBox component is:
mx.controls.ComboBox

Code:
mx.data.components.DataHolder


In the following, the ComboBox gets declared, and the DataHolder generates a "Class can't be loaded" error:


Code:
class my_class extends MovieClip {

var my_cbox:mx.controls.ComboBox;
var my_data:mx.data.components.DataHolder;

function my_class() {
// constructor function
}

}


Sure, it fails because there is no "components" folder in the mx.data folder (at least on my system), and I have been unable to find any DataHolder.as file anywhere either, even though the documentation gives examples that reference the mx.data.components-folder for various data components. I even tried re-installing to make sure I had not accidentally deleted any classfiles, but still no luck.

Am I missing something really obvious here? Does anyone know how to successfully import, declare or otherwise make use of data-components in external class files? Any help greatly appreciated.

Send Form Data To A Php Script Which Writes The Data To A .txt File
Hi!

Ok, this might be very easy but I´m new to both AS and PHP so I´m struggling here and I havent found any useful tutorials to use only small bits here and there.

What I want to do: I have a form which send data to a php script which then writes the data to a .txt. This .txt file is then used by a .swf file to display certain values.
I also have 1 field that I want to use as a validation field as a simple(but yes, not very safe) way to make sure only the right persons submit information.

I have got the .swf file to read the .txt file so thats no problem.

Has anyone got any suggestions about how I do this?

I have an idea of letting the validation field be checked against a .txt file and if one of the lines in the .txt file matches the validation field the rest of the information is submitted and sent to the php script.
Difficult?

Many thx in advance!

Is There Anyway To Read Data In From A Text File And Populate An Array With The Data?
hello,
i'm new to flash, and i'm trying to create a photo gallery. however, the photos may not always be the same, and i need to have a way to easily change the pictures without having to go back into flash to change the code everytime. i thought a good way to do this would be to read the names of the pictures in from a text file and then use those names to populate an array, similar to the tutorial on creating a photo gallery on kirupa.com. the problem is, i have no idea how to do this. anyone have any ideas?
thanks

Converting Internal Array Data Into External XML Data [renamed]
I have this code inside my flash to name my navigation menu. Now I want to put this outside flash and load it via XML. How do save my different arrays into a variable for later use in my code?

In my nav fla (what i want to load from XML):

Code:
// MAIN MENU ARRAY
var mm_array:Array = ["MAIN1", "MAIN2", "MAIN3", "MAIN4"];

// SUB MENU ARRAY
var sm1_array:Array = ["sub1", "sub2"];
var sm2_array:Array = ["sub1", "sub2", "sub3"];
var sm3_array:Array = ["sub1", "sub2", "sub3"];
var sm4_array:Array = ["sub1", "sub2", "sub3", "sub4"];
var submenu_array:Array = [];
XML loading code

Code:
// LOAD MY XML
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
if (success) {
// what goes here to define: mm_array, sm1_array, sm2_array etc
myXML.load("myXML.xml")
XML file something like this:

PHP Code:



<navigation>
    <menu>
        <mm_array>main1</mm_array>
        <sm_array>sub1</sm_array>
        <sm_array>sub2</sm_array>
    </menu>
    <menu>
        <mm_array>main2</mm_array>
        <sm_array>sub1</sm_array>
        <sm_array>sub2</sm_array>
        <sm_array>sub2</sm_array>
    </menu>
</navigation> 

XML Data Displayer, Help Adding Multiple Data Fields Relating To XML
I recently used the Displaying XML Data tutorial, but cant seem to figure out how to add more dynamic text fields and populate them with more <person> and <comment> attributes.

Here is my code:

function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("inventors.xml");

and xml:

<?xml version="1.0"?>

<inventors>
<person>
<name>Thomas Edison</name>
<comment>Inventor of many things such as the incandescent lightbulb.</comment>
</person>
<person>
<name>Doug Engelbart</name>
<comment>Invented the mouse at the Stanford Research Institute</comment>
</person>
<name>Patrick</name>
<comment>did this xml file</comment>

</person>
</inventors>

I am trying to display Patrick - and did this xml file.

Could you please help me figure out what I am doing wrong here?

Is There Anyway To Read Data In From A Text File And Populate An Array With The Data?
hello,
i'm new to flash, and i'm trying to create a photo gallery. however, the photos may not always be the same, and i need to have a way to easily change the pictures without having to go back into flash to change the code everytime. i thought a good way to do this would be to read the names of the pictures in from a text file and then use those names to populate an array, similar to the tutorial on creating a photo gallery on kirupa.com. the problem is, i have no idea how to do this. anyone have any ideas?
thanks

Help Me Define My Search.. ( Sound Data To Graphic Data)
I don't know what the actual terminology is so my searches are tanking. What I want to do is to take an audio file and based on the tones and whatnot generate graphics that move with the music. The visualizations in Windows Media Player do exactly what I want but I don't know what it is actually called.

Any help to point me in the right direction is much appreciated.

Thanks

Scroll Bar Works For External Data But Not Internal Data
Howdy,

I have a dynamic text box named 'outputbox'. This is set for multiline. I have an associated scroll bar.

I make a lot of these kind of calls:


PHP Code:



history.onPress = function() {
    outputbox._visible = true;
    loader = new LoadVars();
    loader.load("history.txt");
    loader.onLoad = function() {
        outputbox.text = this.history;
    }; 




This works great, the scrollbar becomes active when the text goes beyond the outputboxes boarders.

In addition, this 'outputbox' also has a variable (Var) associated with it named 'myTally'. At some particular frames I am generating content for this variable thusly:


PHP Code:



for (receipt = 0; receipt<23; receipt++) {
    
    description = _root["config"+receipt][1];
    price =  _root["config"+receipt][2];
    if (description != 0) {
    mytally = (mytally+"
" +description+" "+ price); }





Indeed, the outputbox certainly gets populated but the scrollbar does not work. When I select-and-drag the text it definitely goes beyond the boarders of the outputbox. If I change the font size of this outputbox (8pt to 16pt) then the scrollbar *does* work.

Why does the scrollbar react to an external file and not my dynamically generated variable? Is something not scoped or in focus? I really have no idea. Anyhow, any suggestions of where to look for resolution would be greatly appreciated.

Thanks,
Cheez

Flash Data Intergratino Useing Xml Data Bases
im not huge newbee to this , iv overcome the majority of the studid little qustions but i ask you this , how do you create adatebasse of say mp3s thru flash using a xml database. first, how do you embeed say mp3 files into a xml document and so on and so on

How To Drag Column Data From One Data Grid To The Anther?
How to drag column data from one Data Grid to the anther?
Hi,
I build an application in mx2004 and I have 2 dataGrid instants containing data.
I am looking for a way to let the user drag a row of data from a data grid and drop it in anther data grid.
I have an “EventListener” on “myListener.cellPress” caching the data, but I could not find a way to determine where to drop the data and how to insert it to the destination dataGrid.
Thank
Nimrod

Flash Sends Data To PHP, Browser Waiting For Data
Hi,

I have the following problem. I'm implementing a flash form mailer using PHP to send out the mail. I'm doing this in the actionscript to sed out the data:

_root.mcDataField.loadVariables("form.php", "POST");

Then my PHP script looks like this:

$sendTo = "xyz@server.com";
$subject = "Some title here";

$headers = "From: " . $_POST["Name"]. "<" . $_POST["Email"] . ">
";
$headers .= "Reply-To: " . $_POST["Email"] . "
";
$headers .= "Return-Path: " . $_POST["Email"];

$message = $_POST["Message"];
$retVal = mail($sendTo, $subject, $message, $headers);


When I sendthe data, it gets emailed, but the browser shows (in the bottom left corner): "Waiting for xyz.com", where xyz.com is the server I have my files on.

Any idea would be greatly appreciated! Thank you!

How To Drag Column Data From One Data Grid To The Anther?
How to drag column data from one Data Grid to the anther?
Hi,
I build an application in mx2004 and I have 2 dataGrid instants containing data.
I am looking for a way to let the user drag a row of data from a data grid and drop it in anther data grid.
I have an “EventListener” on “myListener.cellPress” caching the data, but I could not find a way to determine where to drop the data and how to insert it to the destination dataGrid.
Thank
Nimrod

MyComboBox.addItem(label [,data]) How To Add Data?
The Flash help says to add an item to a ComboBox using myComboBox.addItem(label [,data]). I have no problem adding the label but my data is two items: unit and value. How do I add these two pieces of data?

An example of a comboBox listing might be:
Label: Rope
Unit: Feet
Value: 2.00

So if a user selects Rope, they will see it's $2.00 a foot.

Thanks for any help.

Data Connection/Data Holder Comps
I do a lot of developing with SQL->PHP->XML->FLASH, and end up having to deal with a LOT of data that I both recieve and send. I really just noticed the Data Connection/Data Holder comps like...today and I dont really see how they are all that much better than just using my own array's and objects. Perhaps my limited understanding of them prohibits my appreciation. Anyone care to enlighten?

AS2: Data Bind SQL Query Data To ComboBox
Can anyone point me in the right direction - I'm using Flash remoting with CFCs and I'm trying to pull query data from SQL and populate a ComboBox with AS2 components.

I have a CFC called "states.cfm" and Flash Remoting is set up and connecting properly (AS2 components). It's pulling 2 columns from the states table, "state" and "stateValue". In the flash movie there's a dropdown with an instance name "dd_states". I've searched all over (Using Flash,macromedia,google,flashkit) and I can't find a clear example using the AS2 databinding components using data from a SQL Query....

ThxInAdv

Data Grid Versus Data Connection Kit
can anybody explain me an advantage of data connection kit
over data grid, is it realy better? there is no test version of firefly so u can not test it.

i mean does anybody used the data grid and than chaned to
firefly?is this connector-resolver stuff that usefull? is it worth 299$

thanks nermin

AS2: Data Bind SQL Query Data To ComboBox
Can anyone point me in the right direction - I'm using Flash remoting with CFCs and I'm trying to pull query data from SQL and populate a ComboBox with AS2 components.

I have a CFC called "states.cfm" and Flash Remoting is set up and connecting properly (AS2 components). It's pulling 2 columns from the states table, "state" and "stateValue". In the flash movie there's a dropdown with an instance name "dd_states". I've searched all over (Using Flash,macromedia,google,flashkit) and I can't find a clear example using the AS2 databinding components using data from a SQL Query....

ThxInAdv

Saving Data And Loading Data From A .txt File...
Hi,
I know there's a way to do it but i just couldn't get the right tutorial around..
I have read through Shared Objects but i couldn't get it work...

I just have to save my data, maybe array into .txt file and later on
retrieve from the same .txt file...

Anyone here have an example or some source code so i can have reference on it?

Thanks for the help provided....

Regards,
Lacus

AS2: Data Bind SQL Query Data To ComboBox
Can anyone point me in the right direction - I'm using Flash remoting with CFCs and I'm trying to pull query data from SQL and populate a ComboBox with AS2 components.

I have a CFC called "states.cfm" and Flash Remoting is set up and connecting properly (AS2 components). It's pulling 2 columns from the states table, "state" and "stateValue". In the flash movie there's a dropdown with an instance name "dd_states". I've searched all over (Using Flash,macromedia,google,flashkit) and I can't find a clear example using the AS2 databinding components using data from a SQL Query....

ThxInAdv

Scottys Resize Gallery The Gallery With Thumbnails And Multiple Galleries Problem
Hi all,

I'm relatively new to flash and was looking through the forums and found Scottys cool resize gallery which i am trying to implement in a dreamweaver website.

This is probably a stupid question but i was wondering if anyone could tell me how to add in a fifth gallery to the program - i'm probabaly doing something stupid but i can't seem to access the actions panel at all to look through the code??

Any help would be greatly appreciated!!

Also, does anyone know if this gallery will take forever to load onto a webpage or will it load relatively quickly!??

Thanks a mil in advance
Derm

This Is A Fix To The Image Gallery Tutorial - Makes It A Fully Dynamic Gallery
After searching and reading a couple of hundred post on the truly GREAT Kirupa image gallery tutorial - and wondering why nobody has written a new tutorial or at least updated the "old" one to avoid overloading the net with flash image gallery questions.

Im trying to create a new thread that will serve as a basic startingpoint for all Kirupa gallery questions. Im no überscripter nor do I know a lot about flash, but with a little common sense and perhaps some help from all of you... oh well - here goes:

Quick Checklist:

If your JPG's wont load - Make sure you don't save them as progressive JPG's, as they wont load in Flash.
If your images dont align to the photo container movieclip it is probably because your registration point of the photo MC is set to center instead of topleft.
Below is the code I have pieced together from different posts on the subject (I would like to credit all the authors, but that would require me reading all the posts again, as I have forgotten where I got them.

It produces a gallery that loads files dynamicaly thru a phpscript and checks for maximum image height/width and scales the images to fit within the photo MC. It also sets the center of the displayed images to a given coordinate (x,y).

All in all this is a install and forget image gallery, where the only maintaining required is uploading new pictures to the image folder.

On the server the file/directory structure is:
gallery swf
filearray.php
images/file_x.jpg
file_y.jpg
etc...

This is the filearray.php - modify this to check for files in the path set in the actionscript line: this.pathToPics = "images/";


PHP Code:



  <?php  if ($dir = opendir("images")) {    while (($file = readdir($dir)) !== false) {          $cont++;      if ($file == "." || $file == "..") { } else {              $string.= ($file);          $string.= "&";          }        }      closedir($dir);  }  print($string);  ?>





This is the modified actionscript from the original Kirupa gallery script:


ActionScript Code:
// This loads the array created by filearray.php and puts it into pArray   lv = new LoadVars();  lv.load("filearray.php");  lv.onData = function(text){  pArray = text.split("&");  for (i=0; i<pArray.length-1; i++) {  trace(pArray[i]);  }  }    // variables ------------------------------------------  // put the path to your pics here, include the slashes (ie. "pics/")  // leave it blank if they're in the same directory  this.pathToPics = "images/";  // fill this array with your pics (set from filearray.php)  this.pArray = pArray;            this.fadeSpeed = 20;  this.pIndex = 0;    // MovieClip methods ----------------------------------  // d=direction; should 1 or -1 but can be any number  //loads an image automatically when you run animation  loadMovie(this.pathToPics+this.pArray[0], _root.photo);    // Center the photo at (x,y) the coordinates are set in line 69  MovieClip.prototype.centered = function(x, y) {  this._x = x-this._width/2;  this._y = y-this._height/2;  };  // Makes sure that the image fits within (wMax, hMax)  MovieClip.prototype.resize = function(wMax, hMax) {  while (this._width>wMax || this._height>hMax) {  this._xscale = this._yscale -= 1;  }  };  // This line sets max width and max height (wMax, hMax)  photo.resize(397, 297);    MovieClip.prototype.changePhoto = function(d) {      // make sure pIndex falls within pArray.length      this.pIndex = (this.pIndex+d)%this.pArray.length;      if (this.pIndex<0) {          this.pIndex += this.pArray.length;      }      this.onEnterFrame = fadeOut;  };  MovieClip.prototype.fadeOut = function() {      if (this.photo._alpha>this.fadeSpeed) {          this.photo._alpha -= this.fadeSpeed;      } else {          this.loadPhoto();      }  };  MovieClip.prototype.loadPhoto = function() {      // specify the movieclip to load images into      var p = _root.photo;      //------------------------------------------      p._alpha = 0;      p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);      this.onEnterFrame = loadMeter;  };  MovieClip.prototype.loadMeter = function() {      var i, l, t;      l = this.photo.getBytesLoaded();      t = this.photo.getBytesTotal();      if (t>0 && t == l) {          this.onEnterFrame = fadeIn;          // This line sets the (x,y) center of the image on the stage          this.photo.centered(249, 213);      } else {          trace(l/t);      }  };  MovieClip.prototype.fadeIn = function() {      if (this.photo._alpha<100-this.fadeSpeed) {          this.photo._alpha += this.fadeSpeed;      } else {          this.photo._alpha = 100;          this.onEnterFrame = null;      }  };


This should do it - the only thing I (think) I need some help with is changing the script to actually load the FIRST image, when the gallery loads. For some reason beyond my knowledge you have to click the next button for a image to load... What part of the script needs to be changed to make sure that a image is loaded on startup???

I hope someone will take the time to help develope this gallery tutorial / help file... It would be great if you added som more steps to the quick checklist... and of course fixed the load image on start problem....

This Is A Fix To The Image Gallery Tutorial - Makes It A Fully Dynamic Gallery
After searching and reading a couple of hundred post on the truly GREAT Kirupa image gallery tutorial - and wondering why nobody has written a new tutorial or at least updated the "old" one to avoid overloading the net with flash image gallery questions.

Im trying to create a new thread that will serve as a basic startingpoint for all Kirupa gallery questions. Im no überscripter nor do I know a lot about flash, but with a little common sense and perhaps some help from all of you... oh well - here goes:

Quick Checklist:

If your JPG's wont load - Make sure you don't save them as progressive JPG's, as they wont load in Flash.
If your images dont align to the photo container movieclip it is probably because your registration point of the photo MC is set to center instead of topleft.
Below is the code I have pieced together from different posts on the subject (I would like to credit all the authors, but that would require me reading all the posts again, as I have forgotten where I got them.

It produces a gallery that loads files dynamicaly thru a phpscript and checks for maximum image height/width and scales the images to fit within the photo MC. It also sets the center of the displayed images to a given coordinate (x,y).

All in all this is a install and forget image gallery, where the only maintaining required is uploading new pictures to the image folder.

On the server the file/directory structure is:
gallery swf
filearray.php
images/file_x.jpg
file_y.jpg
etc...

This is the filearray.php - modify this to check for files in the path set in the actionscript line: this.pathToPics = "images/";


PHP Code:



  <?php  if ($dir = opendir("images")) {    while (($file = readdir($dir)) !== false) {          $cont++;      if ($file == "." || $file == "..") { } else {              $string.= ($file);          $string.= "&";          }        }      closedir($dir);  }  print($string);  ?>





This is the modified actionscript from the original Kirupa gallery script:


ActionScript Code:
// This loads the array created by filearray.php and puts it into pArray   lv = new LoadVars();  lv.load("filearray.php");  lv.onData = function(text){  pArray = text.split("&");  for (i=0; i<pArray.length-1; i++) {  trace(pArray[i]);  }  }    // variables ------------------------------------------  // put the path to your pics here, include the slashes (ie. "pics/")  // leave it blank if they're in the same directory  this.pathToPics = "images/";  // fill this array with your pics (set from filearray.php)  this.pArray = pArray;            this.fadeSpeed = 20;  this.pIndex = 0;    // MovieClip methods ----------------------------------  // d=direction; should 1 or -1 but can be any number  //loads an image automatically when you run animation  loadMovie(this.pathToPics+this.pArray[0], _root.photo);    // Center the photo at (x,y) the coordinates are set in line 69  MovieClip.prototype.centered = function(x, y) {  this._x = x-this._width/2;  this._y = y-this._height/2;  };  // Makes sure that the image fits within (wMax, hMax)  MovieClip.prototype.resize = function(wMax, hMax) {  while (this._width>wMax || this._height>hMax) {  this._xscale = this._yscale -= 1;  }  };  // This line sets max width and max height (wMax, hMax)  photo.resize(397, 297);    MovieClip.prototype.changePhoto = function(d) {      // make sure pIndex falls within pArray.length      this.pIndex = (this.pIndex+d)%this.pArray.length;      if (this.pIndex<0) {          this.pIndex += this.pArray.length;      }      this.onEnterFrame = fadeOut;  };  MovieClip.prototype.fadeOut = function() {      if (this.photo._alpha>this.fadeSpeed) {          this.photo._alpha -= this.fadeSpeed;      } else {          this.loadPhoto();      }  };  MovieClip.prototype.loadPhoto = function() {      // specify the movieclip to load images into      var p = _root.photo;      //------------------------------------------      p._alpha = 0;      p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);      this.onEnterFrame = loadMeter;  };  MovieClip.prototype.loadMeter = function() {      var i, l, t;      l = this.photo.getBytesLoaded();      t = this.photo.getBytesTotal();      if (t>0 && t == l) {          this.onEnterFrame = fadeIn;          // This line sets the (x,y) center of the image on the stage          this.photo.centered(249, 213);      } else {          trace(l/t);      }  };  MovieClip.prototype.fadeIn = function() {      if (this.photo._alpha<100-this.fadeSpeed) {          this.photo._alpha += this.fadeSpeed;      } else {          this.photo._alpha = 100;          this.onEnterFrame = null;      }  };


This should do it - the only thing I (think) I need some help with is changing the script to actually load the FIRST image, when the gallery loads. For some reason beyond my knowledge you have to click the next button for a image to load... What part of the script needs to be changed to make sure that a image is loaded on startup???

I hope someone will take the time to help develope this gallery tutorial / help file... It would be great if you added som more steps to the quick checklist... and of course fixed the load image on start problem....

Duplicating
ok, after too many cups of coffee and racking my brain, I am still unable to figure this out. Hopefully some of you OO Gurus can give me a hand.

I have a movie that pulls its content from an external XML file. What I would like to do is set up a loop with actionScript that creates a button for each element that is found in the XML file. I am able to pull the data that I need from the external file, and dump it into an array, but I am not sure how to create the buttons... I imagine it has something to do with duplicating a pre-existing movie clip, but I'm not sure exactly how this would work. Can anyone offer some advice and / or code examples?

Many thanks.
Marty

Duplicating MCs, Take A Look At This Example
I am trying to create a falling snow effect. I am having the following problems with the script below:

1) it duplicates only once
2) the _x does not change after first duplication.
3) also, a bonus question, how can I time out duplication so that all MC don't snow at the same time.

for (i=0; i<20; i++) {
duplicateMovieClip ("snow", "snow" add i, i);
setProperty ("snow" add i, _x, getProperty("snow" add i, _x)+80);
trace (getProperty("snow" add i, _x));
}


Thanks for your help!

Duplicating MC
I'd like to know how to duplicate a movie clip, multiple times, without having to hand-code each duplication, one at a time. For instance, starting with a box on the left, and having it duplicate itself several times (out to the right), with each box getting progressively lighter (using the alpha setting). Thanks.

Duplicating One Mc
Hello-

I'm a little out of practice so I came here to consult the Flash gurus. I want to take one mc and when the movie is loaded I want to duplicate that mc a random number of times (within 40 or 50) then assign each of those mc's random attributes such as alpha level and dimensions.

I'm assuming it'll be some kind of loop to create the mc's then another loop to assign the attributes to each of the created mc's.

I appreciated any and all help.

Thanks
Dan

Duplicating MCs
hi Guys
i need to get this done:
imagine a movieclip with nothing but a button in it, lets call it "mainMC".
first i load a JPG via loadMovie into another MC which is located inside the "mainMC".
now if i duplicate the "mainMC" it has only the button in it not the loaded JPG, and so i have to load the JPG a second time and a third and so on...

is there a way how i could load the jpg only once in the runtime and then use it for all the copies of "mainMC" i need?

Duplicating?
well for a long time now I've been right clicking on the frame and then pasting it to get another frame of the same, I was wondering if theres an easier way of doing this? for example is there a button I ca push that copy's the current frame and pastes after the frame your currently in???

Duplicating Mcs Into Other Mcs
Hi,

Just a quick one. I need to duplicate an mc but have it duplicate inside another mc, this is so i can scroll a list of dynamically created mcs. What do i need to change to the duplicateMovieClip code?

Cheers.

Steven.

Duplicating MC
is it possible to duplicate MC with action scrip from one MC to another.

on root I have MC "A" which has many MC inside let say "a1", "a2",
on root I also have a MC "B" is it possible to duplicate MC "a1" into "B"?

I will really appreciate any help.

Duplicating MC
is it possible to duplicate MC with action scrip from one MC to another.

on root I have MC "A" which has many MC inside let say "a1", "a2",
on root I also have a MC "B" is it possible to duplicate MC "a1" into "B"?

I will really appreciate any help.

I Need Some Help...duplicating Mc
I'm duplicating a movie clip with this...
for(i=1;i<=max;i++){
duplicateMovieClip("_root.menu0","menu"+i,i)
myMenu = _root["menu"+i]
myMenu.mov.txt = nomi[i]

These are basically little boxes that serve as buttons in a menu. How do I code this so that I can put code on each individual button? For example, now if I put code on say, button 2, all the buttons do that same action. You know what I mean?

Duplicating MCs
Can someone help me with duplicating mc's - It's probably easier to explain what I want to do if you have a look st the attached file -

When you click on the pale blue button, the smalledt circle mc duplicates. What I'd like to do is when you click on the button a second time, the duplicated circle also duplicates, so there is 3 circles. I would like to be able to keep repeating the circle's duplicating, so that there would be lots of circles on the screen. I'm not really big on code and any help would be great! Thanks!

Duplicating Mc's
I could just use some general help on duplicating movieclips.

Duplicating An MC Into A Different MC?
Is there a way to duplicate movies into other movies?

something like this:
code:

this.attachMovie("redBall", "ball", 3);

this.createEmptyMovieClip("MC2", 5)

duplicateMovieClip("_root.ball","_root.MC2.newBall ", 8);

Duplicating MCs
If i duplicate a MC, can't i give it a new path. ie. i have a MC on root, can't i put it to _root.blabla.MC??

Duplicating An MC
I am trying to make a game where stuff falls and you catch to get points but I dont know how to make the MC that you catch duplicate so there is more than one falling. I want it to fall from a specific Y axis, but a randon X axis. If there is another Thread about this could you make a link because my board search isnt working.

Help Duplicating A Swf
hey all,

I'm helping my boss work on our website. It's not my job, but i'm pretty much a jack of all trades when it comes to computers (most of us computer people are). one of the things he's wanted was a nice gallery featuring randomly strewn polaroid photos. I made a small gallery by hand in this style, but he's got a few hundred pictures and can barely cut and paste, let alone work in flash.(besides, he'd kick my behind if I told him to do it himself )

I've managed to find a swf that is exactly what he's looking for, but it isn't available as .fla/open source (although most of his other stuff is). I've contacted him about it, but haven't gotten a response, and i'd kind of like to get this done. Here's a link to exactly what i'm looking to find

http://www.jason3d.com/flash/polaroid.html

It looks like his script is just a little buggy, and to be honest I'm excellent with flash, just not as great with the scripting aspect of it. I can read and understand code (and therefore can pretty much chop what i need into a .fla using c&p, but doubt i could code something like this myself.

What i guess i'd like to know is, are there any other movies that are similar to this, or similar enough for me to edit to fit what i'm looking for? If not, how deep would the water i'd be treading in be, if i were to try to code this myself?

Thanks in advance all, hoping for a somewhat fast response, as I've been trying to figure something out to get this done. I might even be able to get my hands on a T-Shirt or two(we've got a small clothing line, in addition to our regular products) to send to someone who is nice enough to try to lend a hand

In any case, thanks for reading

edit : Fixed retardo grammer in the title

Duplicating Mc - How Do I Do It?
yeah so how do i duplicate an MC?

Duplicating Over Another MC
Hey again.

Dmonkey helped me with this problem about two weeks back, and I just started back on my project, and noticed that the code he gave me was near perfection, but still had one big problem. I have an array of weapons in my game, with MCs for each of them within the player MC. Now on fire, I duplicate a bullet movieclip to the weapon's nuzzle, and it will fire at the correct angle. My original weapons were a pistol and shotgun, and since both of these didn't have rapid automatic fire, I never noticed the problem. Once I placed my SMG in, with it's automatic fire, I noticed that when you would shoot, although one bullet would start playing it's animation, the instant another bullet was created, it stopped the last bullet's animation and that last bullet would almost instantly dissapear.

This is the code I use for the duplicating (thanks to dmonkey again):


PHP Code:



//Used attach movie to put movie to the root
            _root.attachMovie("bullet", "bullet"+bulletNum, _root.getNextHighestDepth());
            //made a point object
            var point:Object = {x:0, y:0};
            //converted the tip of the gun (point 0, 0) to a global co-ordinate
            _root.player.arms.weapon.currWeapon.localToGlobal(point);  
            //assigned these global coords to the bullet
            _root["bullet"+bulletNum]._x = point.x;
            _root["bullet"+bulletNum]._y = point.y;
            _root["bullet"+bulletNum].gotoAndPlay("shoot");
            //applied the rotation
            _root["bullet"+bulletNum]._rotation = player.arms._rotation;
            bulletNum ++;





Here is the FLA:
http://denvish.net/ulf/1137380705_wargame_nosound.fla
(Flash MX 2004 or better required)

Thanks!
~ Pol

Copyright © 2005-08 www.BigResource.com, All rights reserved