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








How To Get The Flv Files In Preloder Method?


please how to get the flv files in preloder method?

any example given to me urgent requirement?

with example for coding ..........




General Flash
Posted on: Mon Nov 20, 2006 7:37 am


View Complete Forum Thread with Replies

Sponsored Links:

What Is Good Method To Parse Several Files?
I want to load menu which contains several options using XML parsing. The menu would load as xml and each option too.

For example:
Menu -> What's New? | Web | Contact
Container -> which contains data of each option

menu.xml
<menu>
<option>What's New?</option>
<option>Web</option>
<option>Contact</option>
</menu>

whatsnew.xml
<whatsnew>
<item>
<date>01.10.07</date>
<desc>bla...</desc>
</item>
</whatsnew>


What is the ideal way to deal with XML parsing?
Let's if I don't want to create two same method of parsing.
For now on, I can load menu...

Thinking to create a Object class:
package {
public class objItems {
public var date:String;
public var description:String;
public var icon:String;
etc...
}
}

package {
var _loader:URLLoader;
var obj:ObjectItems;
var menuList: XMLList;

public class LoadFile {

public function LoadFile():void {
obj = new ObjectItems();
_loader = new URLLoader();
_loader.addEventListener(Event.COMPLETE, parseXML);
_loader.load(new URLRequest(obj.file_menu));
}
}


protected function parseXML(event:Event):void {
try {
var menu:XML = new XML(_loader.data);
// Create a list of buttons
menuList = menu.option;
drawMenu();
} catch (e:Error) {
... error...
}
}
}

View Replies !    View Related
Merging Multiple XML Files Via AppendChild Method
I am trying to load and merge multiple xml files. I have all the loading and everything working correctly, with the exception of getting appendChild to work so that I can merge the results!!!!! Here is the full source http://donaldparkerproductions.com/vv/demo.zip

Here is code that does most of the work, i've removed some of the unnecessaries:
Code:


var loadedXML:XML = new XML(<body></body>);
trace(loadedXML.toXMLString());

function search():void
{
   loadedXML = new XML; //clear previous
   searchables_ary = new Array();
   for each(var c:CustomCheckBox in chkBoxes_ary)
   {
          switch (c.selected)
        {
         case true: 
          searchables_ary.push(c.loc);  //.loc is a public variable in the CustomCheckBox class, set to the location of the xml file
        }
   }
   
   if(searchables_ary.length == 0)
   {
      return;
   }

   
   for each(var fileLoc:String in searchables_ary)
   {
      trace("Loading file: " + fileLoc);
      var loc:String = fileLoc;

      var xmlReq:URLRequest = new URLRequest(loc);
      var xmlLdr:URLLoader = new URLLoader();
      xmlLdr.addEventListener(Event.COMPLETE, loadResponseXML);
      xmlLdr.load(xmlReq);
      
   }
}

function loadResponseXML(e:Event):void
{
   //var FresultsXML:XML = e.target.data;
   //trace(e.target.data);
   //loadedXML.appendChild(Object(e.target.data));
   var responseXMLL:XMLList = new XMLList(XMLList(e.target.data).menuItem);
   //trace(responseXMLL.length());

   for each(var item:XML in responseXMLL)
   {
      trace(item.length());
      //trace(item)
      loadedXML.appendChild(item);   //EVERYTHING WORKS BUT THIS
      
   }
   
   trace(loadedXML.toXMLString()); //AND THIS
}

View Replies !    View Related
Calling Two Sound Files With AttachSound Method In Flash
I have used following function in flash two call a sound file from library. Its working well b ut it seems to be that its calling one file only(the second one), Can anybody tell me how to call the two sound files with attachSound method with the help of action scripting

on(release)
{
Sound1 = new Sound(this);
Sound1.attachSound("charge_r2.wav","charge_r3.wav" );
Sound1.start(0,99)
gotoAndStop("mute");
}

View Replies !    View Related
Preloder
needhelp with setting for preloder to go directly to amin page, I have everything working in my flash movie, the only part i'm having trouble with is when it says accesing site in my movie - I can't get to go to main page smothley. Can anyone help??????

View Replies !    View Related
Preloder Like This...
hey, just wondering if anyone can direct me to a tutorial or paste in some script on how to do a preloader like on this site:

http://www.gridplane.com

basically i'm after a really smooth preloader, as i'm having problems with mine being too clunky and also my loadbar doesn't reach 100% properly—i've just fudged it for now.

http://www.atype.com.au

here's the currect script i'm using:


Quote:




onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per*9.43;
if (percent>99) {
_parent.gotoAndPlay(2);
}
}




cheers
iota.

View Replies !    View Related
Preloder
does any one know how to add a swf movie after a preloder loads if you can tell me the action script that would be cool and where to place it thank you

View Replies !    View Related
Preloder
whats up everyone i had a problem with some preloders not playing the movie right and i was asked to put the swf files here . one has the preloder and the other has the movie it is supposed to plane any help would be great thanks

View Replies !    View Related
Please Help With A Preloder
Preloader
Hi!
I wonder why this code don't work?
Here's the code:

Code:
onClipEvent (enterFrame) {
_height+=_root.getBytesLoaded()/_root.getBytesTotal()*79;
}

Can it be something with that that the code is in a movieClip in a mask?

thanks Albert
Love this smiles

View Replies !    View Related
How 2 Add A Preloder ?
hies
my prob is simple but i can't get itz ans anywhere
okies so hope i get it here
i don't know how to add a preloader into my movie
i used to make a loadin' sequence and then the main page comes
but tatz not right
i want people 2 see the loadin' clip while the site is loadin'
plz iif u know do reply
thanx

View Replies !    View Related
Really Simple Preloder
is there a really easy preloder script which takes up about 2 frames? ill put an MC in for the animation, i just want somethin simple cos its only for a web page, not the entire site.

Thanks

View Replies !    View Related
How Would It Be Possible To Make A Preloder Appear....
How would it be possible to make a preloder appear before the rest of the movie, and have it show loading.... or something so that the people waiting to see it know that it is loading?

View Replies !    View Related
Preloder 3 Movies
I've got on one page 3 different movies, now I want to have 1 preloder in front of that page because it takes an different amount of time to load the movies.

How can I create a preloder that doesn't stop before all other 3 are loaded?

View Replies !    View Related
External .Jpg Preloder
Hey, the tutorials and other question i have found here haven't really helped. I want to create a preloader that can be duplicated (not necessary yet) and loads an external images.

Can any one get me of the ground with this one?

any help would be greatly appreciated, thanks.

View Replies !    View Related
Preloder Question
hi,
I want to do a preloader and are a bit confused. some use different scenes and some place the preloader in the first keyframe. some use a own swf-file for the preloader. I wonder whats the difference? Is one solution better than the other?

I really want to know what you think before I decide in what way I do my preloader.
I also wonder if you have to use ifFrameLoaded because all in my mainmovie is in one frame. it must be possible to load the movie without counting the frames.

/vicky

View Replies !    View Related
Percentege Preloder
Could somebody please point me to a percentege preloader component? without a loadbar etc, only the percentege preloder.

View Replies !    View Related
Percentege Preloder
Could somebody please point me to a percentege preloader component? without a loadbar etc, only the percentege preloder.

View Replies !    View Related
Preloder Problems( Not Showing)
I made a prealoder, my code is pretty simple and it works perfect with the file were I have a static image in second scene. But when I place the prealoder into more complicated file were I also have two scenes (all my second scene movie clips sitting in library and actions calling them to play) Preloder not showing up.The movie plays (after download completed) but ignores the preloader... there is some conflict.
Here is my preloder:
first frame action-

total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded ("Scene 2", 60) {
gotoAndPlay ("Scene 2", 1);
}

and my next frame, same scene:

gotoAndPlay (1);

and in second scene there is no actions in the Timeline( only "stop()" at the last frame were it has to be anyway.


Do you thing I'm missing something?Maybe You know anybody who could help.
Thanks in advance
Irina

View Replies !    View Related
Preloder Works In Simulation But On The Web
A while ago I found on another board a nice piece of preloading code for multiple images. It seemed to be working great until I've actually posted the swf on the web. The text field displaying the loading progress in % started showing NaN until about 85-90% of the totalbytes were loaded. This would coincide with the first image actually popping up. This does not happen in a simulation mode: the first image shows up at the same point but the percentage is displayed correctly way beforehand and grows steadily from ~5 to 100%. I think the reson behind this behavior are dynamically created emptyMovieClips that are being used for loading images. Preloader must be getting confused every time the new one pops up and resets itself to NaN. I tried to include a line of code that would correct it but it doesn't seem to be doing anything. I'm not emotionally attached to this script so if anyone has suggestions for a preloader that would grab images from the external folder while displaying the progress in percentage I would appreciate.




code:
//number of images to be displayed:
srcL = 10;
//source of Images for a gallery:
imageFolder = "Graphics/Gallery_1";
var Images = new Array();
for (i=0; i<=srcL; i++) {
Images[i] = [imageFolder+"/image"+i+".jpg"];
}
// create one clip for each movie
// and load the movie into each one.
for (var i = 0; i<Images.length; i++) {
var tmp = this.createEmptyMovieClip("clip"+i, i);
tmp.loadMovie(Images[i]);
}
// now set up an onEnterFrame event
// to continually check the load progress
// and update the bar clip
this.onEnterFrame = function() {
var stat = 0;
// initial status
for (var i = 0; i<Images.length; i++) {
var tmp = this["clip"+i];
stat += (tmp.getBytesLoaded()/tmp.getBytesTotal())*100;
}
stat /= Images.length;
// get the average status value
if (isNan(Stat) || tmp.getBytesTotal()<8) {
return;
} else {
this.bar._xscale = stat;
// set the width of the bar to reflect the load status
this.txt.text = Math.round(stat)+"%";
trace(stat);
// if the load is complete, cancel the onEnterFrame
if (stat == 100) {
delete this.onEnterFrame;
}
}
};
stop();

View Replies !    View Related
Preloder - Macromedia Style
hi all,

i'm looking for a preloader like the one macromedia have (or used to have?) - the arrow circling around with a slight fade in it's tale end.

i'm wondering if anybody has ever come across one like this?

thanks!
jose

View Replies !    View Related
Help With Second Preloder Inside Main Movie
Hi guys.
Ive followed some tutorials and got my main preloader running correctly, still needs a tidy up but works.
There is a movie in the root folder of the site that is called by the spec sheets button...it is a big ish movie so ive used the identical preloader for it with some taxt changes.......it works fine on my system but when online the bix of the preloader appears but it runs incorrectly.....im realy puzzled....??
If any one can help the site is located at

http://www.deveronside.co.uk/staffy/
and the button in question is the one for spec sheets
Thanks in advance fpr any suggestions
Les

View Replies !    View Related
Preloder Headache - Dynamic Preloader
OK, What I`m doing is,this:
I have a movie which creates serval movieclips which then will be used by a controller Movieclip to load other external swfs into them.
This controller movieclip is itself effectively a preloader. Actually everything works fine, save one problem:

The preloader pops up, doesen`t show any loadingprogress, the target movie in whom the external swf is being loaded disapers, there is nothing for a moment. Then according to connection time the requested movie appears.

What might be the reason of this ? All suggestions / ideas / Xtremly welcome !!!

You might watch the effect at spade-trading.com

Unfortunately I'm not at Work (it`s 1 O Clock in the Morning in Germany) right now, but rather keept from sleep by this Problem.
This Is why I can`t post any code right now...

View Replies !    View Related
How To Make A Preloder Inside Of A MovieHolder
Hi,
all pro..in flash. im a newbie and want to explore the capability of
flash MX .i want to learn how to create a preloder inside of MovieClip. like when you make a loadmovie inside of MovieClip instead of level. hope for your respond.
and thanks a lot .q^_^p

View Replies !    View Related
Preloder For Multiple Movie Clips
Hello there.
I'm building a website where i have 9 thumbnails on the main time line
What i want to achieve is to press on the thumbnail which will redirect to
a movie clip each time fairly big in size and have a preloader for each thumb. Load the content before it enters the first frame of each movie clip since the content is fairly big in size.(3d animation)
Can you suggest something please

Thx:)

View Replies !    View Related
Attach Sound, Export In First Frame And Preloder
Hello. i use MX (6) ver. of Flash and I am working on slide show with sound background. I use attache sound method to play sounds. But.

Attached sound work only when i allocate
-Export for ActionSript and
-Export in first Frame.
And problem is all lincked sounds starts loading in very begin. So my preloader doesnot work well. Cuz preloader starts work only when sounds are loaded. To escape this problem i could not allocate -Export in first Frame. But in this case attache sound method doesnot work.

I see only one exit now. Create preloader and main movie in different swf but it is not i really want. How to use attach sound method with linked sounds but do not allow them load in first frame?

Thanks

View Replies !    View Related
Function In A Method Return True To Method's Caller?
I think I probably don't know the correct terminology to ask this question, but here goes:

In this example, can anyone tell me how to have the setComplete event function within the main method return true to the caller of the method, instead of just to the listener?


PHP Code:



    function loadAsset(target:MovieClip, asset:String, assetLoaderInfo:LoaderInfo): Boolean    {    var assetLoader:Loader = new Loader();    var assetURLRequest:URLRequest = new URLRequest(asset);    assetLoader.contentLoaderInfo.addEventListener(Event.OPEN, setLoaderInfo);    assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, setComplete);    function setLoaderInfo(event:Event)        {        assetLoaderInfo = event.currentTarget;        }    function setComplete(event:Event)        {        target.addChild(assetLoader);        return true;        }    assetLoader.load(assetURLRequest);    }

View Replies !    View Related
Function In A Method Return True To Method's Caller?
I think I probably don't know the correct terminology to ask this question, but here goes:

In this example, can anyone tell me how to have the setComplete event function within the main method return true to the caller of the method, instead of just to the listener within the method?

Many thanks!


PHP Code:



function loadAsset(target:MovieClip, asset:String, assetLoaderInfo:LoaderInfo): Boolean
    {
    var assetLoader:Loader = new Loader();
    var assetURLRequest:URLRequest = new URLRequest(asset);
    assetLoader.contentLoaderInfo.addEventListener(Event.OPEN, setLoaderInfo);
    assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, setComplete);
    function setLoaderInfo(event:Event)
        {
        assetLoaderInfo = event.currentTarget;
        }
    function setComplete(event:Event)
        {
        target.addChild(assetLoader);
        return true;
        }
    assetLoader.load(assetURLRequest);

    }

View Replies !    View Related
Preloder ScaleX Property And X Property
Hi!

within the loader listener's progressevent I had my preloader mc update the scaleX property and works fine, thus, it moves and scales just like a preloader does until it reaches 100. My only concern is when scaleX updates the preloader mc 'x' location seems to be moving as well making the preloader clip looked liked it scales on both sides (both ends of the line). As i examined the preloader mc 'x' property it stays the same all throughout. This is weird.

anyone?

thank you in advance.

View Replies !    View Related
Importing Files/ Opening Files In Files/ Adding Files Into Scenes.
Alright Here is the deal.
I got some movies, which are seperate FLA. files, and I want to eventually add all these 4 seperate files, into scenes in one main FLA. file. How do I do this so that I have the symbols ect. I am pretty sure you can't just copy/paste.

Which FLASH** guru out there can lead me in the right direction?


greatly appreciated...

*g.guru.

View Replies !    View Related
[AS2 OOP] Calling A Method In A Method
Hi everyone
i'm not quite sure how to phrase my problem, so i'll examplify:

Code:
class A{
function A(){
trace("construct");
}
private function moo(){
trace("moo!");
}
private function cow(){
trace("start mooing");
moo();
}
}
this does what I expect it to: construct, start mooing, moo!

Code:
class A{
function A(){
trace("construct");
}
private function moo(){
trace("moo!");
}
private function cow(){
trace("start mooing");
_root.onEnterFrame = function(){
trace("moo!")
}
}
}
this also does what I expect it to: construct, start mooing, moo!, moo!, moo!, ...

Code:
class A{
function A(){
trace("construct");
}
private function moo(){
trace("moo!");
}
private function cow(){
trace("start mooing");
_root.onEnterFrame = function(){
moo();
}
}
}
yet this doesn't, I'd expect it to: construct, start mooing, moo!, moo!, moo!, ...
yet the moo! moo! moo! doesn't appear, as if moo() never gets called it all.
so what I'm I doing wrong?

View Replies !    View Related
.bat Files Start From .swf Files But Not From .html Files ?
I tried to use fscommand to execute certain batch files on my system. It worked fine while I tested the swf file, but didn't do anything when I published the movie and tried the same in the .html file ?
Any clues ?

-Shreeram

View Replies !    View Related
Save Information From Flash Files Into Text Files For Later Retrival..?
so i can load information from textfiles which is all very well, but can i save information into text files from flash? Please help me on this one!!! Thanks!

View Replies !    View Related
Retaining Order Of Files Loaded Externally From Large XML Files
Hi everyone,
I was messing around with some old examples, and I ran into an unfinished example where several 30k-100k XML files are loaded and stored as a string into an Array. The code looks basically like:

Code:
//example input: foo.xml%zeeb.xml%blarg.xml
function loadXML(filePaths:String) {
filesArray = filePaths.split('%');
for (var i:Number = 0; i<filesArray.length; i++) {
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(success) {
if (success) {
//order of files loaded is messed up here!
parseXMLData(this, filesArray.length);
} else {
//trace(filesArray[1]+" failed to load!");
}
};
xmlData.load(filesArray[i]);
}
}
Basically, when I trace the 'this', the order of the files that are loaded is off. Out of about 10 tries, about 3 times the order is perfect. The remaining 7 times, the order is a bit off. Does anybody have a suggestion on how to ensure the files are loaded prior to the next file being loaded?

I tried placing a while loop that basically delays the clock for a few milliseconds, and that didn't work either. Besides, that is not really a good solution to arbitrarily waste clock cycles. I am guessing some sort of a listener might be needed, but that is where I've hit a wall

Thanks!
Kirupa

View Replies !    View Related
For... In ... Method
Hi all,
I have some problem with the

for( iterator in Object ) method

because it iterates on my Object returning properties in reverse order
In other words if I define a Object Person with

Fabio = new Person()

function Person(){
firstName = "Fabio"
birthday = "28-10-1970"
eyesColor = "Blue"
}

and then I use

for (i in Fabio){
trace(Fabio[i])
}

this method returns my Object properties in reverse order

eyesColor
birthday
name

instead of

name
birthday
eyesColor

Is there anyone who can tell me if it is possible to get my Object properties in the same order i defined them?

Any help will be very appreciated

View Replies !    View Related
GET Method
I have a PHP script that need two variables...
what is the correct syntax in flash ?



on (release) {
Status = "Beginning registration Process... Please Hold";
loadVariablesNum ("Register.php?RegName="+RegName ????&???? RegPassword="+RegPassword, 0);

}

thnx

View Replies !    View Related
A Method Of Self Help
This may sound odd, but for those who are budding flash developers, I think I found a way (aside from buying books and what not) to learn Flash MX commands rather well.

Open Flash MX, Press SHIFT+F1 (Reference), open the INDEX on the left, and one by one click on each and READ!

I've been doing this and what makes it all sink in is that I am writing what I read into a notepad file. The process of both reading and writing (seeing and doing) makes remember not only that object easier, but you know expand your thinking process when a problem presents itself.

Like you can get a eureka moment if a problem exists, and since you remember better what you read, you have an increased chance of formulating an answer with code.

Not only that, but you should try the code out. Set aside some time to test the code you're a little iffy on, and if that doesn't work, do a google search on ACTIONSCRIPT and the keyword you're having problems with.

I'm a forgetful person, and I've been doing these steps and learning SO MUCH. Hopefully it'll work well for others too.

View Replies !    View Related
& In Get Method
Hello!

I need to pass some text to display it in my .swf movie i'm using loadVariables to do this: http://myserver.com/content.php?id=1 but in this text there are some Baltic characters like õ, now php outputs it like this: text=ettev& #245;te and when my movie sees the & it treats it like another variable for example: text=tettevote&id=1 here are two variables text and id.

Is there a way around this?

View Replies !    View Related
Method In Other Method
Why if I call a method "makeFunction()" it works and if I call the same method fro the method "Down()" it doesen't work?

dynamic class SingleMovieClipEvents extends MovieClip {
private var movieClipPath_mc;
private var functionName;
private var args_array:Array;
private var theFunc;
public function SingleMovieClipEvents(mC:MovieClip, funNa, args:Array) {
functionName = funNa != undefined ? funNa : null;
args_array = args != undefined ? args : null;
movieClipPath_mc = mC != undefined ? mC : this;
setMovieClip();
makeFunction();
}
private function setMovieClip() {
movieClipPath_mc.onRelease = Down;
}
private function Down() {
this.gotoAndStop("down");
makeFunction();
}
private function makeFunction() {
if (functionName) {
theFunc = eval(functionName);
theFunc.apply(this, args_array);
}
}
}

View Replies !    View Related
WHAT's The Best Method? . . . .
Best Method for Text ?:

Ok, need a bit of help from some flash experts with a fair few applications under their belt, particularly ones that involved formatted text.

I’ve making an interface (application) that has about 6 different sections, video, multimedia, art, noise, bio’s and poetry text. So far i’ve basically got a “thumbnail” that you click, it then goes to the corrosponding frame in that scene and the movie/file needed loads into a movie/instance in that frame called “blank” (pretty creative naming huh? ;-)).

The interface its self is fairly bais, it stay with the style of graffiti and all things load on a brick wall, using graf fonts and a few tags etc. Most things work fine except for a few hiccups.

My problem is this:

I now have about 250-300 poems to get in to the interface, all with rich formatting (bold, italics, spacing, diff size fonts, etc) and all sent as DOCS. My thoughts were to do the following:
Convert all into RTF files using Appleworks (yes, I’m on a mac) or a similar converter (Vinc seems ok), import each one into Freehand since it seems to preserve most RTF and then bring the resulting SWF file into FLASH, paste it into a basic movie that has a simple scroll bar and then export that movie and name it appropraitely, move onto the next one . . .

I know it’s possible to load fomatted text into Dynamic text boxes from text files but I’ve so far not been able to get a handle on this (am using Flash MX) and I’m not sure it would be able to handle the “aligning” spaces, etc involved. The reason I’m using a scroll bar is that some poems are very long and won’t fit on the “WALL”, otherwise I’d just paste them in a graffiti font and leave it there.

Anyway, could ppl let me know of any pitfalls they see in this method, problems, etc or if anyone knows a better way (or has or has seen any examples of one) then please let me know. Have to get started on this soon and don’t want to be half way through it when some expert points out a brilliant stylish method that I hadn’t thought of that then makes me tear my hair out.

Thanks very much for any help or advice on this, it is GREATLY APPRECIATED.

Cheers

scart

View Replies !    View Related
Which Is The Best Method
Hi,

I would like to know, does anyone have any suggestions as to the best way to create a flash video gallery that can be used in a website.

I would welcome any samples or tutorials that may be available.

I would appreciate it very much.

Cheers

View Replies !    View Related
Best Method For:
Got a project I need help with and I need to know if the fallowing is possible and if so what would be the best method for accomplishing it.

Need:
Virtually I need to know how to build a small flash GUI that allows users to name their so called "projects" then click a button ("Build") that will copys/pastes a directory and name this copy what ever the user called it on this flash GUI.

Of course this Flash GUI will have to reside in the same folder as the directory its going to be duplicating. I just need to know if I should be looking at XML help or PHP or if action script might be able to do the whole copy and paste while naming actions.

Thanks.

View Replies !    View Related
Best Method For This?
hi all, im just creating a quick thing for my dad which has lots of objects on the stage and when the user hovers over an object he wants the object to turn red (50% tint) (the object can also be clicked to go to a different frame)
would it be best to have them all just as buttons, or as movieclips and addEventListeners to them all to the one function?
or is there a different way?
thanks
Dan

View Replies !    View Related
Key Hit Method?
Ive got this Key class, to replace what was lost with AS2 (Using AS3):


Code:
// Key.as
package {

import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;

/*
* The Key class recreates functionality of
* Key.isDown of ActionScript 1 and 2. Before using
* Key.isDown, you first need to initialize the
* Key class with a reference to the stage using
* its Key.initialize() method. For key
* codes use the flash.ui.Keyboard class.
*
* Usage:
* Key.initialize(stage);
* if (Key.isDown(Keyboard.LEFT)) {
* // Left key is being pressed
* }
*/
public class Key
{

private static var initialized:Boolean = false; // marks whether or not the class has been initialized
private static var keysDown:Object = new Object(); // stores key codes of all keys pressed
private static var keysReleased:Object = new Object();
private static var wasPressed:Boolean = false;



/*
* Initializes the key class creating assigning event
* handlers to capture necessary key events from the stage
*/
public static function initialize(stage:Stage)
{
if (!initialized)
{
// assign listeners for key presses and deactivation of the player
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(Event.DEACTIVATE, clearKeys);

// mark initialization as true so redundant
// calls do not reassign the event handlers
initialized = true;
}
}

/*
* Returns true or false if the key represented by the
* keyCode passed is being pressed
*/
public static function isDown(keyCode:uint):Boolean
{
if (!initialized)
{
// throw an error if isDown is used
// prior to Key class initialization
throw new Error("Key class has yet been initialized.");
}
return Boolean(keyCode in keysDown);
}

public static function isPressed(keyCode:uint):Boolean
{
if (!initialized)
{
// throw an error if isDown is used
// prior to Key class initialization
throw new Error("Key class has yet been initialized.");
}
if (wasPressed == false)
{
return Boolean(keyCode in keysDown);
wasPressed = true;
}else{
return false;
}
}

public static function isReleased(keyCode:uint):Boolean
{
if (!initialized)
{
// throw an error if isDown is used
// prior to Key class initialization
throw new Error("Key class has yet been initialized.");
}

return Boolean (keyCode in keysReleased);

}


public static function clearKeysPressed():void
{
keysDown = new Object();
}

/**
* Event handler for capturing keys being pressed
*/
private static function keyPressed(event:KeyboardEvent):void
{
// create a property in keysDown with the name of the keyCode
keysDown[event.keyCode] = true;

}

/**
* Event handler for capturing keys being released
*/
private static function keyReleased(event:KeyboardEvent):void
{

if (event.keyCode in keysDown)
{
// delete the property in keysDown if it exists
keysReleased[event.keyCode] = true;
delete keysDown[event.keyCode];

}

}

/**
* Event handler for Flash Player deactivation
*/
private static function clearKeys(event:Event):void
{
// clear all keys in keysDown since the player cannot
// detect keys being pressed or released when not focused
keysDown = new Object();
keysReleased = new Object();
wasPressed = false;

}
}
}
Anyone any ideas how i can add a Key Hit method, so it'll only register when the key is initially pressed, then it'll go back to false?

View Replies !    View Related
Best Method
For building my website, is it better to use getURL commands to load my other pages, or loadMovie commands and have it all be one happy .swf file?

View Replies !    View Related
AS3 Best Method
As of now, im using URLLoader to send a variable to a php file and use that to connect to mySQL, the php file then echos back an XML with the results. Once that is back in flash I parse it out and use the data. Once I receive the data my application begins to run extremely slow. I've removed the listener once the load has completed, i've tried loader.close(). So this is my question, is it possible to use the URLStream in this case? Will that have any effect? Or is there a better way to go about this. I'm only grabbing, as of now, about 10 values from the database, but there will be a lot more I need to get. So if it is lagging down to a crawl already, then something must be wrong.

View Replies !    View Related
There Is No Method With The Name ?
I have an .as file with the code:

Math.getMiddle = function(a,b){

...

}

I have a .fla file that includes the .as file and then trys to run the methods in the .as file. I get the error:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 357: There is no method with the name 'getMiddle'.

Anyone help?

View Replies !    View Related
What's The Best Method? . . . .
Best Method for Text ?:

Ok, need a bit of help from some flash experts with a fair few applications under their belt, particularly ones that involved formatted text.

I’ve making an interface (application) that has about 6 different sections, video, multimedia, art, noise, bio’s and poetry text. So far i’ve basically got a “thumbnail” that you click, it then goes to the corrosponding frame in that scene and the movie/file needed loads into a movie/instance in that frame called “blank” (pretty creative naming huh? ;-)).

The interface its self is fairly bais, it stay with the style of graffiti and all things load on a brick wall, using graf fonts and a few tags etc. Most things work fine except for a few hiccups.

My problem is this:

I now have about 250-300 poems to get in to the interface, all with rich formatting (bold, italics, spacing, diff size fonts, etc) and all sent as DOCS. My thoughts were to do the following:
Convert all into RTF files using Appleworks (yes, I’m on a mac) or a similar converter (Vinc seems ok), import each one into Freehand since it seems to preserve most RTF and then bring the resulting SWF file into FLASH, paste it into a basic movie that has a simple scroll bar and then export that movie and name it appropraitely, move onto the next one . . .

I know it’s possible to load fomatted text into Dynamic text boxes from text files but I’ve so far not been able to get a handle on this (am using Flash MX) and I’m not sure it would be able to handle the “aligning” spaces, etc involved. The reason I’m using a scroll bar is that some poems are long and won’t fit on the “WALL”, otherwise I’d just paste them in a graffiti font and leave it there.

Anyway, could ppl let me know of any pitfalls they see in this method, problems, etc or if anyone knows a better way (or has or has seen any examples of one) then please let me know. Have to get started on this soon and don’t want to be half way through it when some expert points out a brilliant stylish method that I hadn’t thought of that then makes me tear my hair out.

Thanks very much for any help or advice on this.

Cheers

scart

View Replies !    View Related
What Method Is This?
Hello all. I came across a cool newsfeed on
http://iblog.chubzz.com/ ANyone know how they did it..? its to the rigt asa you open up the site.

-R

View Replies !    View Related
Targeting External Files To Text Files In Flash
Gooday all

I am developing a flash site for a movie company and it needs to be 100% dynamic! and must be flash 5 compatible

To put things as simply as I can here goes.

I have a directors page - on this page I have two text fields.
The first text field pulls all the directors names from an external file called directors.html, In this external file I have html hyperlinks which link to each directors bio text (in another external text file), what I want to do is basically target the second text field in flash. i.e. when you are in flash and click one of the directors names his info must appear in the adjacent text field.

you follow?

THIS DOESNT LOOK LIKE A COW!

View Replies !    View Related
Loading External Text Files With Links To .swf Files
i am loading a external text file with html links. I would like to know if anyone out there know how to make those links load .swf files, that would work with the levels hierarchy of the original level0 file. I tried passing a variable that would be detected by a movie clip on EnterFrame but no success, maybe I had written something wrong. Loading just the swf file will replace the html page on the browser.

View Replies !    View Related
Reading From Files, Manipulating Strings, Writing To Files....
Thanks for your time, if you know anything please help me with the following:

1) I have my movie www.web.com/web.swf that reads the contents of the file www.web.com/news.txt. The file is supposed to contain different notes referring to updates of a site (just an example)

2) Flash loads the text in a variable, right? How can i split it, considering i use as a splitting string something like "|splithere|"

3) How can i hold each update-note in a variable, like when i`m duplicating movie clipes, for example update1 should be held in u1, update 2 in u2 and so on... (or as visual basic used - i`m and ex vb'er - u(1) u(2) and so on)

View Replies !    View Related
Explorer Type View Of Files Sending Files
I'm building a website to enable a kind of online music jam session. The user will choose music files stored on their computer to be uploaded to other users' "shared folder" (eg. c:mysharedfolder on user1 to c:mysharedfolder on user2 - similar principle to Kazaa I guess).

How do I display a list of the files contained within the users "shared folder" (like windows explorer)?

Secondly, is it possible to send someone a file directly to their "shared folder"?

Many thanks,
Simon

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved