[flashcs3/as2] Help With XML
ok so i am using flash CS3 with AS2. (i gave up on the AS3)I am making a simple flash website. I would like to use XML so that when people need to edit it after me, they dont need flash, and they dont need to really know alot about what is going on. I have 7 main pages, 3 of which will have sub-menus. when they click the sub-menu i want it to pull up formatted text and pictures (from my XML file). or if i have a photo gallery how to do it with that. i know that there used to be easy tutorials on here, i just havent been on here in over a year and a half (CS2 was fairly new and CS3 was almost out). would someone help me out, or point me to the good tutorials that can help??thanks a TON!!!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-23-2008, 08:22 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
AIR In FlashCS3
hi@all,
i am new in this Forum and i download the trail version from Adobe flash CS3 because i want to know how the new as3 works. Then i found an install file to install AIR on Flash CS3. I am really happy that it is possible to creat AIR files with flash^^. Now to my question: I disabled the systemeChrome in the window options because i wont the standart window. And now i would build my own window, but i don`t know how i can close, minimize and drag the window with Flash. Does anybody know some codes how i can do this things??
Thanks a lot for your helps and sorry for my bad english^^
FlashRemoting For FlashCs3
Hello to everybady
Where are the components of Flashremoting for Flash Cs3 (AS3 code)? I can't find them in Flash Cs3
or in the components page of Flashremoting in adobe.com.
Thanks.
Liciof
[FlashCS3/AS2] Newbie Needs AS2 HELP. Please
I think I'm close, but not quite there. Basically, I'm trying to make the timeline advance to a specific frame after I select an item from by ComboBox...
Here is what I have so far:
Code:
//SETS DATA FOR COMBOBOX
myCB.dataProvider = [
{},
{value:"0100", name:"DISPATCH"},
{value:"0101", name:"TRAINING"}
];
myCB.labelField = "name";
//IF STATEMENT FOR COMBOBOX
if(myCB.selectedItem.label == "DISPATCH"){
gotoAndPlay(2);
trace("It Works");
}
Xml Parsing AS2 FLASHCS3
HI, guys, thanks for taking your time to read this thread,
im newbie in as and getting stress now, so i hope anyone can help me
i have xml and this is the code
<?xml version="1.0" encoding="UTF-8"?>
<data>
<genre id="1">
<id>1</id>
<root>0</root>
<name>Action</name>
<description>Action</description>
</genre>
<genre id="6">
<id>6</id>
<root>0</root>
<name>Thriller</name>
<description>Thriller</description>
</genre>
<genre id="7">
<id>7</id>
<root>0</root>
<name>Comedy</name>
<description>Comedy</description>
</genre>
<genre id="8">
<id>8</id>
<root>0</root>
<name>Romantic Comedy</name>
<description>Romantic Comedy</description>
</genre>
<genre id="10">
<id>10</id>
<root>0</root>
<name>Classics</name>
<description>Classics</description>
</genre>
<genre id="11">
<id>11</id>
<root>0</root>
<name>Cult</name>
<description>Cult</description>
</genre>
<genre id="12">
<id>12</id>
<root>0</root>
<name>Documentary</name>
<description>Documentary</description>
</genre>
<genre id="13">
<id>13</id>
<root>0</root>
<name>Indie / Foreign</name>
<description>Indie / Foreign</description>
</genre>
<genre id="15">
<id>15</id>
<root>0</root>
<name>Children</name>
<description>Children</description>
</genre>
<genre id="16">
<id>16</id>
<root>0</root>
<name>Musicals</name>
<description>Musicals</description>
</genre>
<genre id="18">
<id>18</id>
<root>0</root>
<name>TV Shows</name>
<description>TV Shows</description>
</genre>
<genre id="19">
<id>19</id>
<root>0</root>
<name>War</name>
<description>War</description>
</genre>
<genre id="23">
<id>23</id>
<root>0</root>
<name>Drama</name>
<description>Drama</description>
</genre>
<genre id="31">
<id>31</id>
<root>0</root>
<name>Music & Concert</name>
<description>Music & Concert</description>
</genre>
<genre id="43">
<id>43</id>
<root>13</root>
<name>special collection</name>
<description></description>
</genre>
<genre id="44">
<id>44</id>
<root>13</root>
<name>criterion collection</name>
<description></description>
</genre>
</data>
</xml>
and now, i want to parsing the xml and get the id node from this xml
so here's the code:
/*global variabel declare*/
var label:TextField;
var duplicate_genre:MovieClip;
/*end declare*/
/*Opening connection with xml*/
myXML = new XML();
var id:Array;
var path_id:Array;
myXML.ignoreWhite = true;
myXML.load("http://localhost/subcat/index.php/movie/genre");
myXML.ref = this;
myXML.onLoad = function(succes) {
if (succes) {
var root = this.firstChild;
var nodes = root.childNodes;
for (var i = 0; i<nodes.length; i++) {
subnodes = nodes[i].childNodes;
duplicate_genre= _root.genre.createEmptyMovieClip(["container"+i], _root.genre.getNextHighestDepth());/*make container for dynamic txt genre*/
this["label"+i]=duplicate_genre.createTextField(["labelor"+i], 1, -422, (i*28.5)+(-200), 143.8, 22.6);/*declare position text for genre*/
/*conditional if text <20*/
if (i<20) {
this["label"+i].text = subnodes[2].firstChild.toString();/*write genre xml to dynamic text*/
path_id=_root.genre["id"+i]= this["container"+i]=subnodes[0].firstChild.toString();/*declare id genre xml*/
trace(duplicate_genre+path_id);
/*opening otherXML */
otherXML = new XML()
otherXML.ignoreWhite = true
duplicate_genre.onRelease = function() {
var string="http://localhost/subcat/index.php/movie/lists/1/"+_root.genre.path_id;/*declare url for movie list*/
trace(string);
otherXML.load(string);/*function for load url movie*/
otherXML.onLoad = function(succes) {
if (succes) {
var totalpage = this.childNodes[1].firstChild.toString();
totalpage_txt.text = "("+totalpage+" Movies)";/*function for display total page*/
var root = this.firstChild;
nodes = root.childNodes;
for (var i = 0; i<nodes.length; i++) {
subnodes = nodes[i].childNodes;
_root.genre["cover_title"+i].text = subnodes[1].firstChild.toString();/*function for display movie name*/
_root.genre["genre_name"].text = subnodes[3].firstChild.toString();/*function for display genre name*/
}
} else {
trace("Error loading otherXML");
}
};/*end other xml load function*/
};/*end conditional for on release*/
} else {
trace("erorr loading xml document");
}/*end if text < 20*/
}/*end for Myxml*/
} else {
trace("Error loading XML document");
}
};
/*end connection for myXML*/
the trouble begins here, when i want to take id node at xml and parsing it into http://localhost/subcat/index.php/movie/lists/1/"+_root.genre.path_id,
i'm always get id from the last xml which is "44", and can't be suitable with te container which i clicked,
can u see the problems??
sorry my poor english
anyone have advice???
thanks
Flashcs3 Movie Booboo
Firstly hello! I have been a forum reader for a while - first time forum poster! I am currently making a site for a friend which I have the "layout" uploaded at http://kunkelscleaning.comze.com/ ok.... so in the perfect world that exists only in my little head.. I thought I could make the bubbles bouncing around into buttons haha! Seems that its not so easy... I have it set to AS2 but can set it to AS3 I imagine... but when I started identifying buttons etc. all I could make it do was have X content load up but everything else stops animating. I am very new at flash and this is really the first thing Ive done for flash. I imagine I make separate flash movies and include them in the folder so they can just loop? or is there a AScript that I need - :S ANY HELP would be greatly appreciated. Thank you in advance! Oh and I know im missing info please just ask away and ill try my best, so on that note Sorry in advance!
-Lost
Is Flash 8 Compatable With Flashcs3?
I'm new to flash and want to take a class in it. The instructor requires flash 8, but I'd like to purchase falsh cs3. Can that work or are they just so different?
Unicode's PUA Values In FlashCS3
Hello!
I have a client using Flash CS3 on WinXP. He is having difficulties
using an OpenType TrueType font with some glyphs encoded in Private
Use Area, which simply won't show up.
After browsing online help it seemed to be feasible though.
I tried in a Flash demo myself, but as I have very few knowledge of
the software, I've been unable to replicate the problem.
Beside from getting any step-by-step hint to get this working, can
anyone around here confirm that it is possible to call PUA glyphs in
Flash and output them?
Apart from this narrowed issue, maybe using unicode to call glyphs
from an embedded OTTT font in Flash is not the right way. Glyph
names, indexes or hexadecimal values may be easier, more flexible and
reliable?
Any feedback much appreciated! Thanks.
Flash Vars In FlashCS3
Hi,
I am trying to pass FlashVars to the Flash Movie but for me it doesn't work. I publish the Flash and HTML and then I modify the HTML like following:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
About PrintJob(Actionscript3,flashCS3)
no idea how to solve this "PrintJob"
Please tell me the hint..
(1)my flash version:FLASH CS3(Action script3.0)
(2)OS:MacOS 10
(3)Problem:
I am getting the error that it can not be printouted illustrations
(each instance neme is mcprint1,mcprint2)
(4)About file:
file name: example1
print button(instance neme): Printbutton
illust1(instance name): mcprint1
illust2(instance name): mcprint2
Attach Code
(5)Here is the (error) code
Printbutton.addEventListener(MouseEvent.CLICK, btPrintClickHandler);
function btPrintClickHandler(evt:MouseEvent):void {
var example1:PrintJob = new PrintJob()
var arr = new Array( mcprint1, mcprint2);
if (example1.start()){
try {
example1.addPage(arr, null, null, 0);
}catch(err:Error){
}
example1.send();
}
}
[FlashCS3-AS2] Duplicate Mc, Random _y Help
Greetings - I've been prowling and found a start for what I'm trying to do. Need help refining it. I pilfered the snowconfetti.fla AS and have modified it, but not quite there.
I want to attach a MC at a random _y location, and move it left to right across the stage, at random speeds. Then when it goes offstage, a new one is generated.
Right now the interval loads a new clip at 8 sec. no matter where the current clip resides on stage, so I'm sure that is wrong.
Code:
function brand() {
clip = attachMovie("brand_mc", "brand"+i, i);
clip._x = -50;
clip._y = Math.floor(Math.random()*640);
clip.xspeed = Math.random()*4-1;
clip.onEnterFrame = move;
i++;
if(i > 20){
clearInterval(myInterval);
}
}
function move() {
this._x += this.xspeed;
if (this._x>1100) {
this.removeMovieClip();
brand();
}
}
myInterval = setInterval(brand, 8000);
Thanks much for the help!
Email Button - FlashCS3, AS2.0
I have a flash file and I have 2 buttons at the end that I want to link to emails addresses. I've been using the code:
on(press){
getURL("mailto:you@email.com")
}
I don't have these on an action layer, but on the frame containing the button. All of this works, but when I click the link, a blank html page pops up in addition to a new email form in my email program (thunderbird.)
Does anyone have a solution to this? Or an easier way to link two different buttons to two different email addresses?
TIA!
[flashcs3] Photogallery Needs Refining
I've gone through several tutorials and managed to create a photogallery far beyond what I thought I was capable of. (yay!) While it has all the features I could want (thumbnails in a nice scrolling grid, slideshow option, etc) I've reached a couple of vital stumbling blocks.
a) centering the first image.
Code:
_root.createEmptyMovieClip("fullImage_mc", _root.getNextHighestDepth());
fullImage_mc._x = 100 + ((Stage.width-fullImage_mc._width)/2);
fullImage_mc._y = (Stage.height-fullImage_mc._height)/2;
This works perfectly for all subsequent images, but the first one is displayed wrong. This is because Flash doesn't know the image's height or width before it's loaded. However, if I change these locations to something static, there's a flicker when loading the other images, where the image is first loaded at the static location, then moved to the center.
b) positioning the preloader. Obviously I'd like this to be centered, but the more I've played with it, the worse it gets.
Code:
fullPreloader.onLoadStart = function(target) {
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Geneva";
myFormat.size = 36;
myFormat.align = "center";
myFormat.color = _root.mycolor;
target.createTextField("my_txt",target.getNextHighestDepth,0,0,400,100);
target.my_txt.selectable = false;
target.my_txt.setNewTextFormat(myFormat);
};
This is a secondary issue and at the moment I've just moved it to the top left of the image. If anyone has good advice that would be great, otherwise I may just hide the preloader.
c) slideshow doesn't wait for images to load. So with large images/slow connections the slideshow will move on to the next image before the current one has loaded. My initial solution was to load the next image in a hidden mc whenever an image is loaded and while this kind of works, there are still issues when there are lots of images in the gallery. I've removed this attempt from the attacted file.
What do you think? Is there any hope? Thanks for your help!
HELP FlashCS3 Button Actions Grrrrrrrrr~
Hi Guyzz!
I need help! Ok i have a button that aint behaving!
Basically it just has to load an external page in a new window ...
I have assigned the following actions to it ...
on (release){
getURL("http://www.forexample.com", "_blank");
}
Now its definitely got the actions assigned to the instance of the button & not the hit state inside the buttons keyframes.
The button is inside a movie clip in scene 1.
Its seemed like once the getURL was trying to work and i got a message from the Flash Settings about a security warning like " Adobe Flash is trying to access a (forgot tha rest! )
Any Help would be most appreciated !
tHx, Nikki T
Compiling Flash10 Content In FlashCS3?
Well, the topic says it all. How do you do that?
There's quite a few tutorials and such on creating flash10 specific content, but they are all based on Flex.
I've searched for how to use it with Flash CS3 but found practically nothing.
I found the following comment on this article on theflashblog,
Quote:
You can use Flash CS3 but only with workarounds.
Flash Player 10 doesn’t seem to limit capabilities based on the exported version number. For now, you can export Flash 9 and it will work. Here’s an example of some modified code …
var astro:Namespace = new Namespace(’http://www.adobe.com/2008/actionscript/Flash10/’);
// dynamically created audio
var sound:Sound = new Sound();
function sineWavGenerator(event):void {
for (var c:int = 0; c < 1234; c++) {
var sample:Number = Math.sin((Number(c + event.position)/Math.PI/2))*0.25;
sound.astro::samplesCallbackData.writeFloat(sample );
sound.astro::samplesCallbackData.writeFloat(sample );
}
}
sound.addEventListener(’samplesCallback’, sineWavGenerator);
sound.play();
// 3D rotation
var myShape:Shape = new Shape();
myShape.graphics.beginFill(0×804000);
myShape.graphics.drawRoundRect(-60, -20, 60, 20, 10, 10);
myShape.x = 80;
myShape.y = 40;
addChild(myShape);
function rotateShape(e:Event):void {
myShape.astro::rotationX += 5;
myShape.astro::rotationY += 4;
myShape.astro::rotationZ += 3;
}
addEventListener(Event.ENTER_FRAME, rotateShape);
That doesn't seem to work though. Firstly, there's a couple typos, but even after fixing them it still wont work.
I get:
ArgumentError: Error #2068: Invalid sound.
at flash.media::Sound/play()
at Untitled_fla::MainTimeline/Untitled_fla::frame1()
and If i try this method to use the save/method of the fileReference object i get:
ReferenceError: Error #1069: Property http://www.adobe.com/2008/actionscript/Flash10/::save not found on flash.net.FileReference and there is no default value.
at mapsaver_fla::MainTimeline/mapsaver_fla::frame1()
Does anyone have any idea of how to fix it?
I am downloading Flex right now, in order to be able to use the new FileReference.save method. But I don't fancy the idea of that and i've never used Flex before.
The reason of why I really wan't to do this is to save binary data to a file, which can be quite a hassle otherwise.
Thanks in advance!
Placed Pngs & Jpegs Appear Faded N FlashCS3
I've placed vibrant pngs and jpegs into Flash and now they appear faded/flat? This is apparent even before publishing within Flash itself. I'm working on a mac and saving the pngs and jpegs out of Photoshop. I've even turned off any compression in the publish settings and it doesn't seem to make a difference. Any clues appreciated.
External Variable Issue Using AS3 In FlashCS3
I am trying to pass database values into Flash (using AS3) through a simple PHP script output! The trouble is ... I have not been able to get Flash/AS3 to acknowledge that it has received the supposedly externally loaded data, let alone prove that it is ready to work with the values passed into it in some way. So, OK...
...here is my PHP code (phpCode.php):
Attach Code
<?php
$returnVars = array();
$returnVars['lname'] = "theLastName";
$returnVars['fname'] = "theFirstName";
$returnString = http_build_query( $returnVars );
echo $returnString;
?>
...that (using Firefox) parses the following output:
lname=theLastName&fname=theFirstName
...with an identical "Page Source" output of:
lname=theLastName&fname=theFirstName
Using Flash CS3 and the following AS3 (on Frame 1, through the Actions panel):
var url:String = "http://localhost/site61/php/phpCode.php";
var reqURL:URLRequest = new URLRequest(url);
reqURL.method = URLRequestMethod.GET;
var loader:URLLoader = new URLLoader(reqURL);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, handleComplete);
function handleComplete( event:Event ):void {
var loader:URLLoader = URLLoader(event.target);
var variables:URLVariables = new URLVariables(loader.data);
trace("lname is " + variables.lname);
trace("fname is " + variables.fname);
}
Why does the Flash "Output" panel consistently produce the following?:
lname is undefined
fname is undefined
I need the Flash "Output" panel to produce the following:
lname is theLastName
fname is theFirstName
...that would prove to me that Flash has accepted the variables from the PHP output and is ready the handle them.
I'd truly, seriously, and GREATLY appreciate an effective, working AS3 solution to this issue, as I have had with NO success with any solution I've tried to implement!
Thanks,
Troy
Draggable Background Question [flashcs3/as2]
Hi.. I'm working on a site that utilizes a draggable MC as the background/navigation with easing, to simulate underwater movement...
The problem I'm having is setting the MC's boundaries... I've been able to set up specific x/y boundaries, but I've lost the easing effect with everything tried. Also, I would like the boundaries to set relative to the browser window size, so that the user can always maneuver the whole background (and, of course, not move the background off the screen...).
Any help would be greatly appreciated... I feel like I am just missing it with every attempt.
Here's what I have so far: underwater.swf
And here's my code...
on first frame:
Code:
Stage.align = "CC";
Stage.scaleMode = "noScale";
stop();
on my background MC, 'object_mc':
Code:
onClipEvent (load) {
xfinal = _x;
yfinal = _y;
}
onClipEvent (enterFrame) {
if (drag) {
x = _root._xmouse+xd;
y = _root._ymouse+yd;
} else {
x = xfinal+xd;
y = yfinal+yd;
}
_x = _x+(x-_x)/5;
_y = _y+(y-_y)/5;
}
on my button inside the background MC:
Code:
on (press) {
drag = true;
xd = _x-_root._xmouse;
yd = _y-_root._ymouse;
Mouse.show();
}
on (release, releaseOutside) {
drag = false;
xfinal = _root._xmouse;
yfinal = _root._ymouse;
Mouse.show();
}
[FlashCS3/AS 2.0]Shoot Towards Mouse Pointer
I'm just just starting ActionScript (and programming) and I'm trying to learn by making a game step by step. I don't know if it's the best way to start, but at least I can see what knowledge I'm lacking that way.
Anyway, I've been fine so far but now I'm facing a problem with making my character shoot in the proper direction, which I describe below (I'm sorry, it's a long post, thanks to those who will be patient enough to read it entirely):
My game is supposed to be some sort of real time RPG. Camera view is from top to bottom and the general aspect of the game would be a character walking through a city and shooting enemies along the way.
The character moves with the arrow keys, and he rotates by following the mouse pointer (which means he keeps pointing towards the pointer). The character actually doesn't move, it's the map that does (the character rotates however).
Just a little question here (depending on the answer, my main question might be useless): is it a good idea to make the map, enemies and items move instead of the character? If not, could you please explain why?
And now, for my main question:
The map movement/illusion of character movement with the arrow keys is going fine, as well as the rotation of the character with the mouse. However, I also want him to shoot towards the mouse pointer whenever I click the left mouse button but I don't know how to do this.
I've been looking for tutorials on the web, as well as searching this forum, and I understood that the script would require use of trigonometry (at which I don't know a thing).
I also tried making my own script using a combination of the script used in the linear shooter tutorial on this website, and the script used in the "Detecting direction of mouse movement" tutorial. But all I could get was the projectile moving from the center of my screen to the top left direction of the screen and it's path only slightly changed by the movement of the mouse pointer.
Here is my script (I put it in a frame, in an independent layer with nothing else on it. The projectile is in the library, not on a layer):
Quote:
var spriteX:Number = 1000 ;
var spriteY:Number = 500 ;
var arrowActive:Boolean = false;
//---- functions ----
this.onMouseMove = function() {
xdir = _xmouse;
ydir = _ymouse;
};
function checkKeys() {
if (Key.isDown(Key.SHIFT) && arrowActive == false) {
attachMovie("arrow", "arrows", 8);
arrows._x = spriteX ;
arrows._y = spriteY ;
arrowActive = true ;
}
}
function updateArrow() {
if (arrowActive == true) {
arrows._y -= ydir/100 ;
arrows._x -= xdir/100 ;
}
if (arrows._y<-10) {
arrowActive = false;
removeMovieClip(arrows);
}
}
this.onEnterFrame = function() {
checkKeys();
updateArrow();
- Arrow is my projectile, I drew a small red dot and called it "arrow" in order to match the script from the linear shooter tutorial, and I don't know what "arrows" is referring too because I couldn't find anything about it in the tutorial (and I did not name anything "arrows" myself, but if I remove it from the script it seems it completely stops working).
- My map is 2000x1000
What I need is a script that does the following:
What I can't do:
- Make a projectile move from the tip of the gun to the mouse pointer (tip of the gun does not stay in place since the character rotates. Plus, the character will use different guns, some shorter than others). Also, the projectile should not follow the pointer once it is shot.
- I'd like the projectile not to hit the pointer accurately. Imagine a straight line going from the gun to the mouse pointer; the projectile should follow a straight line randomly set between 0 and x degrees left or right from this line. I would like x to be set in a variable so I could change it. This is in order to make the gun slightly inaccurate.
- The script should still allow me to make something happen when the projectile collides with something (I'll do the collision part myself later, right now I just don't want the script to prevent me from doing it)
That's the hardest part for me, the rest following below I might be able to do it myself but I don't know for sure, so any help is appreciated but not necessary if you don't want to waste your time:
- The script should use a variable for projectile's speed so that I can change it.
- The projectile should disappear after traveling a specified distance and the script should use a variable to set this distance.
- The script should allow to shoot another projectile before the first one disappears (right now I need to wait until the projectile exits the map before I can shoot again and I don't know why). I also need the delay between each shot to be set in a variable so that I can change the rate of fire of the gun.
- I'm also looking for a script that makes several projectiles be shot at the same time, following a different angle (according to the inaccuracy angle I described above), and I would like to set the number of projectiles being shot simultaneously with a variable.
And here's what I think I can do myself:
- The projectile should only be shot when the left mouse button is pressed.
If you give me a script, I would really like it if you could briefly explain it's different parts and how it works. That way I could understand it and learn something, rather than just copying it. I really don't like to ask people to do the work for me, but since I can't find any tutorial I have to ask for help. I'm also aware that maybe I should train a bit more before trying to do such programming, but I won't know for sure until I ask. I'm not a newb who believes he can program great games in 5 days. I'm just doing what I can, and I'm asking for help as less as possible. If I ever see I get stuck too often, I'll train more before continuing.
Thanks in advance to anyone that will help me, any help is *really* appreciated even if you can't solve my problem entirely. And thanks for reading my post until the end. I know it was long, but I wanted to be as clear as possible so that you wouldn't waste your time asking me for more details.
[FlashCS3] Launch Mediabox From XML Imported Into SWF
I am using Flash CS3 and AS2.0 to try and open Mediabox (the lightbox clone for multimedia files) from XML text imported into an SWF movie. The SWF movie is a slideshow which imports images and captions from the XML file. When the user clicks on one of these captions I want to launch another SWF file in a Mediabox window. I think the problem is in the actionscript, rather than the XML.
My first test was to launch Mediabox from a button in an SWF movie and it worked fine. Here is the code that works, followed by my test movie URL:
-------------------------------
Actionscript assigned to button:
on (release) {
getURL("javascript:Mediabox.open('http://www.homestarrunner.com/tgs10.swf','test using mediabox','mediabox[550 410]');");
}
-------------------------------
You can view the result that I am trying to achieve here. Click on the image to launch:
http://www.pockitz.co.uk/gallery_tes...box_test6.html
When I add the actionscript to import an XML file and assign the child information to a button, the result does not work.
1)-------------------------------
XML data which holds the link info and javascript instruction:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>/image1.png</image>
<caption>caption goes here</caption>
<visit>Launch movie</visit>
<link>"javascript:Mediabox.open('http://www.homestarrunner.com/tgs10.swf','test using mediabox','mediabox[550 410]');"</link>
</pic>
</images>
2)-------------------------------
Actionscript to import XML and pass child info to button:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
visit = [];
link = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
visit[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
//this bit pulls the link info from the XML document
link[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("gallery_test6.xml");
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
visit_txt.text = visit[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
visit_txt.text = visit[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
visit_txt.text = visit[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
// this bit takes the link details and creates a function which is then passed to the button.
function myUrl(){
getURL(link[0]);
}
3)-------------------------------
Actionscript assigned to button:
on (release) {
myUrl();
}
---------------------------------
any help greatly appreciated.
Pockitz
[FlashCS3]Help Needed AttachMovie And RemoveMovieClip
Hi, I have a few buttons, and for each button blick, a new background is displayed. I tried the following code but there is a problem. Can anyone help? THANKSSS!
function displayBrowse()
{
var Background:Array = ["CCBackground1", "CCBackground2"];
_root.createEmptyMovieClip("myMCbg_mc", _root.getNextHighestDepth());
myMCbg_mc.attachMovie(Background[0], lbl, this.getNextHighestDepth());
myMCbg_mc._x = 7;
myMCbg_mc._y = 165;
for(i=0;i<2;i++)
{
_root.createEmptyMovieClip("myMCbtn_mc", _root.getNextHighestDepth());
myMCbtn_mc.attachMovie("CCButton", "browseButton"+i, this.getNextHighestDepth());
myMCbtn_mc["browseButton"+i]._x = 23 +(100*i);
myMCbtn_mc["browseButton"+i]._y = 165;
myMCbtn_mc["browseButton"+i]._width = 60;
myMCbtn_mc["browseButton"+i]._height = 25;
myMCbtn_mc["browseButton"+i].label_txt.text = i;
myMCbtn_mc["browseButton"+i].onPress = function() {
whichSubMenu = Number(this._name.substr(-1, 1));
removeMovieClip(myMCbg_mc);
_root.createEmptyMovieClip("myMCbg_mc", _root.getNextHighestDepth());
myMCbg_mc.attachMovie(Background[whichSubMenu], lbl, this.getNextHighestDepth());
myMCbg_mc._x = 7;
myMCbg_mc._y = 165;
myMCbg_mc.swapDepths(myMCbtn_mc);
};
}
}
btn_clear.onPress = function()
{
removeMovieClip(myMCbtn_mc);
removeMovieClip(myMCbg_mc);
}
btn_display.onPress = function()
{
displayBrowse();
}
[Flashcs3]Help Needed With Very Basic Actionscript
hi guys im extremely new to actionscripting and i want to make something that sounds very simple basically i have on the first frame on my movie an input text box with the variable 'password', and a submit button i want to basically be able to enter a "password" into that box and when i press submit i need it to check if that word is the password before showing the next frame which has a dynamic txt box with the variable 'output'. i will outline my basic actionscript thus far:
on the first frame:
stop();
on the button:
on (release) {
_root.nextFrame();
}
on the second frame:
output = "Add the following numbers to the end of the address in your browser and press return, 0873927 ";
so basically i need you guys to help me fill in the gaps that allow a specific word to be the only word that can coninue to that second frame to see the output, im guessing some sort of if statement??
help would bevery much apreciated.
[FlashCS3] Action Script/ XML Gallery
In the XML thumbnail gallery final tutorial on the site, it show an example of the main image linking to a different website. In the xml the code looks good because there is a "<link></link>" tag but it doesn't seem to be working in the action script. Does anyone know what I am missing?
ex: http://www.kirupa.com/developer/mx2004/thumbnails.htm
HELP PLZZ Creating Text Files In FlashCS3
HI, i'm using flash CS3 . IS there a way to create text files in this version??
i've tried MMsave(abc,"abc.txt") and fscommand("save","abc.txt") functions ... but they didnt work!!!!
PLEASE HELP!!!!!!!!! THANKS!!
HELP!!
(FlashCs3) Error Opening Url On Test Movie
After a year of working on the PC, just switched over to the Mac. The other thing that's different is that I recently upgraded to CS3.
Whenever I hit test movie I get a black screen and an error opening url message. Rebuilt the project thinking it had something to do with that. Worked for a while but now the same thing again: error opening url.
What's going on here?
[FlashCS3-AS2.0] Drawing Board Problems And Issues.... Help
ACTIONSCRIPT 2.0:
I have put a drawing board on my application, but i cannot figure
out how to get a colour selector..? Any ideas on this?
Another problem with this, is that when the page is selected i can draw
out of the board, and also when i navigate to another page i can
continue to draw on other pages (not good!)...
Heres the script:
this.createEmptyMovieClip("drawing_mc",this.getNex tHighestDepth());
this.onMouseDown = function() {
drawing_mc.lineStyle(10,0x000000);
drawing_mc.moveTo(_xmouse,_ymouse);
onMouseMove = function() {
drawing_mc.lineTo(_xmouse,_ymouse);
}
}
this.onMouseUp = function() {
onMouseMove = noLine;
}
[FlashCS3]Help Needed - Loading Variable Text
Hi all,
Im doing a uni project - building my website in flash!
Im using actionscript 2.0, I'm not too experienced in this so excuse me if I use incorrect terminology.
Basically - my website has 5 links. Each time you click a link, the webpage is supposed to do an animation, and then load the information (txt file).
I've managed to code it, so that the txt file loads as soon the animation starts but I want it to load AFTER it finishes. Can anybody help?
I've used this
Code:
on (release) {
loadText = new LoadVars();
loadText.load("TEXT1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.myNews;
}
};
}
I'm not sure if I've explained it thoroughly enough but if you are willing to help and I need to provide more information please let me know.
thanks in advance.
[FlashCS3]Beginner Needs HelpBrowser Maximize Code
Hi, I have very little knowledge of code, actually I have zero knowledge of code, and I need help with making my website use the entire browser window without margins.
I found the tutorial "Maximize Flash in your Browser" but I don't know where to place this code <body topmargin="0" leftmargin="0"> to eliminate the margins. Is this done in the actionscript part of Flash or in the index.html file when I drop it in Dreamweaver?
Will this also give my website the ability to resize itself when the browser window is reduced in that nothing will be cut off?
Any help with this is greatly appreciated.
Thank you
[FlashCS3/AS2] Photo Gallery With Lightbox Issue
Hi all,
This is my first post, i'd like to say at first that this forum is great and that all kirupa's tutorials are great.
I've followed the kirupa's tutorial for the photo gallery with the thumbnails and it works perfectly. But what i'd like to do is when the user clicks on a thumbnail, the large image of the thumb opens in a lightbox.
I've used a javascript code for the lightbox that i pasted in my php file, and added the getURl line in the following function in the action script:
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
getURL("javascript:openLightbox('image[k]' , 'description[k]')");
nextImage();
};
I'm not sure though what should i put instead of 'image[k]' , 'description[k]'
Now when i click on the thumbnail, the lightbox works but the picture doesn't appear i have the rex 'X' instead of the pic.
I hope you understood what my problem is, if not let me know i'll try and explain better.
Can anyone please help me with this issue ?
Thanks in advance.
wesh
[FlashCS3] Dead Links In Multiple Browsers
Hopefully a no-brainer:
I am currently developing a banner that contains 4 buttons. Each of these link to different URLs within the website where the banner appears.
The problem:
SWF functions beautifully on its own (i.e., animations play, rollovers work). However, when uploaded to the server and dropped into the HTML with the proper plug-ins, the links suddenly cease to function. Flash still plays beautifully - it's just the links that seem to disappear. The one browser where the links seem to work 'as is' is Firefox on PC.
I am using the basic but usually effective:
on (release) { getURL("http://www.site.com"); }
Sorta-solution:
Added "_blank" to the end of the script and this worked in all tested browsers... however, the client wants the URL to open in the same window (they have asked not to provide the actual link). Anyone have a concrete idea as to why and how to fix this?
I've hunted for this issue and found lots of "keep trying" solutions in other forums... please help
Flashcs3 AS2 External Swf (calling Xml) Will Load But Won't Play
I am totally new to actionscript. Learning by watching others. Been watching here for
a long time. Just joined though. I really hope I can explain this so you can help.
___________________________
I found a slideshow which uses an xml file to load jpgs. (albumV2.swf)
The xml contains jpgs, and captions.
When I publish it on its own...works fine.
Now I'm trying to place albumV2.swf inside a deeply nested mc.
I'm using a button to navigate to the target movieclip (holder_mc) which I want to contain the external swf.
on (release) {
loadMovie("albumV2.swf", "_root.streetText.buildBuilding.zoom2wall.main_mc. holder_mc");
}
when I test
The albumV2.swf loads, I can see the background for the photos. But it won't play.
There are thumbnails in the swf that don't show, but there's also a timer and counter in the swf
that do show.
All the photos are called from the xml doc, but I can't see them. However, I CAN see the first caption that's in
the xml.doc.
and only the first caption.
I wondered if the code in the original slideshowFLA uses some hierarchy that I'm screwing up, but shouldn't the xml be fine once it's found?
Didn't want my first post to be too long, so I won't post the as, but I can if it will help.
Thank you in advance.
FlashCS3: External Class Getting Current Frame Label
Hello, I'm trying to still wrap my head around moving to AS2->AS3. I've got he concept down of document classes replacing any code on the timeline, and also attaching classes to movieclips. My question and explanation of problem is this:
say I have a document class Main.as
I also have a movie clip with a class attached to it named loadHTML.as
In the main timeline I have frame labels, Page1, Page2, Page3 etc..
I'm trying to get the LoadHTML.as to figure out which frame label the main timeline is on, and I want to use that information to load the right external html file. But I can't figure out how to access the frame label of the main timeline. It's just the root timeline.
In the end I'd love to have a reusable class that i can attach to movie clips so i can always load html files via frame labels.
Thanks in advance for any help or leads!
[FlashCS3 - AS2.0] Dynamically Loaded MovieClips Don't Respond To Mouse Events?
I'm trying to place 5 instances of a horizontal line (mcLine) starting at 78% from the top of the Stage. This all works fine, but I want to be able to have these dynamically created MovieClip instances register mouse events and they don't.
First the setup of the mcLine instances:
var nFirstLineY:Number = (Math.round(Stage.height*.78));
var nLineSpace:Number = 22;
var nWaitTime:Number = 1000;
var nInterval:Number = setInterval (drawLine, nWaitTime);
var nTimes:Number = 1;
// drawLine function attaches Line movie clip instance, names it "line_" + nTimes for instance name, and places it on next highest level (nTimes)
function drawLine()
{
_root.attachMovie("mcLine", "line_"+nTimes, nTimes, {_x: 0, _y: nFirstLineY, _width: Stage.width});
nFirstLineY += nLineSpace;
nTimes ++;
if (nTimes >=6)
{
clearInterval (nInterval);
}
}
Then, I'm just using the following to try and make the lines "vibrate" when rolled over by the mouse pointer, by frame-jumping to the appropriate part of the movie clip, like so:
line_1.onRollOver=LineVibrate;
line_2.onRollOver=LineVibrate;
line_3.onRollOver=LineVibrate;
line_4.onRollOver=LineVibrate;
line_5.onRollOver=LineVibrate;
function LineVibrate() {
this.gotoAndPlay("vibrate");
}
If I place instances of the mcLine MovieClip on the stage and name them line_1, line_2, etc., the function LineVibrate works, but when I try to add the instances at run time as above, the LineVibrate function stops working.
Can anyone tell me what I'm missing here?
Export FlashCS3 SWF To MOV - "Unknown Error"
Hi, Flash Kit Community,
I'm new to Flash and am having a significant problem producing output. Am trying to Export (or Publish, doesn't matter which) my SWF file to a QT MOV file for re-import into Premier Pro. (Why doesn't Premier have a direct "Import SWF" option, anyway?). But no matter how I adjust Flash Export settings (down-rev to Flash 5 or earlier, disable streaming audio, adjust frame rate, image size, etc. ) the "Exporting Flash Content" progress bar completes successfully, but after that I get only the following message:
"Could not complete operation because of an unknown error"
Grrrrr.............. Export and Publish functions in Flash CS3 seem to me in general to be a little on the light side. There are a half-dozen codecs supported for Export to AVI but not one of them is less than 10 years old. No direct export with DivX, WMV, etc. codecs seems to be supported. Sigh. Anyway, none of the AVI export options seems to work either except for Export to AVI Full Frames (uncompressed) which generates unmanagable HUGE files.
My system configuration is as follows:
SOFTWARE: Flash Version 9.0, full CS3 package, PremierPro, also full box. I also added QT7 Pro just in case it came with some special Apple-related MOV codec that might be required.
HARDWARE:
WindowsXP SP2
Intel Core duo Quad 2 6600 CPU 2.4GHz 3.5Gb RAM
nVidia Quadro FX 3450/4000 video card
Creative SB X-Fi sound card
INSTALLED VIDEO CODECS (as far as I can tell):
DivX 6.8.0
iccvid.dll
Indeo Video Interactive R4.5
Indeo Video R3.2
Indeo Video RAW YVU9
iyuv_32.dll
Ligos Indeo Video 5.11
msh261.drv
msh263.drv
msrle32.dll
msvidc32.dll
msyuv.dll
smdvCodec.dll
Xvid MPEG-4 Video Codec
Has anyone in the community encountered this "unknown error?" problem in Flash 9/CS3? It absolutely positively will not export or publish my SWF to MOV no matter what I try. As I mentioned, Export to AVI works only on the Full Frames (Uncompressed) setting (other codec settings will export, but no video is visible upon playback, only the audio). Do you think that I need an additional codec? Or does it sound like some sort of hardware conflict (wrong video card, too much RAM, etc.)? Is there some burried setting in Flash that I am not getting right?
Also, I don't know whether the following means anything or not but I tried using the Flash Video Encoder to do something with the SWF file (I know, it doesn't look like FVEnc is supposed to be used for this purpose, but I tried). Anyway, FVEnc did in fact accept the SWF file into its queue, but displays the message "This file has no readable video track" and only generates an empty "SWD" file.
I'd be grateful for any help with this. Thanks in advance.
Ruth3rf0rd
[FlashCS3] Pls Help Roll Over Menu Conflict With Roll Out - Vimeo Menu Style
Hi there,
I'm trying to make the menu in FLV player like Vimeo but it seems roll over always conflict with roll out script (I just start to learn how to write script and use only basic onRollOver, onRollOut). I am totally have no idea how to make the video controls visible only when you roll over the video clip like VIMEO. It looks like they build it on different way of mine as when the mouse over the flash area their cursor still be an arrow but mine is hand pointer.
Please anybody could help me or give me some suggestion.
Many many thanks,
Yota
|