Checking For Invalid Domains In Forms
Hey
I want to check this form field (Var:email) in my flash file so that spesific email domains cant be registered (example: online.no)
I want do do something like this
var d = email.split("@")[1] // d = everything after the @ sign if(d == "online.no" || d == "frisurf.no"){ gotoAndPlay ("online"); trace("domain not allowed") }
But im not quite sure how i put this piece of code in my excisting code under, can anyone give me a hand here??
// validate email function // function validate (address) { if (address.length>=5) { if (address.indexOf("@")>0) { if ((address.indexOf("@")+2)<address.lastIndexOf(".") ) { if (address.lastIndexOf(".")<(address.length-2)) { return (true); } } } } return (false); } // // form check // function formcheck () { if ((((email == null)) || (email.length<1)) || (email == "Adressen er ikke gyldig")) { //
email = "Adressen er ikke gyldig"; action = ""; } if (!validate(email)) { email = "Adressen er ikke gyldig"; action = ""; } if (fname == null) { fname = "Må fylles ut"; action = ""; } if (lname == null) { lname = "Må fylles ut"; action = "";
if ((validate(email)) && (email != "Feil!") && (fname != "") && (lname != "")) { action = "send"; loadVariablesNum (mailform, 0, "POST"); gotoAndPlay ("wait"); } } stop ();
Thanks! Retro....
FlashKit > Flash Help > Flash ActionScript
Posted on: 01-09-2004, 05:11 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Checking Against Domains With AS & PHP/text
Hi,
I have an FLA for a calculator tool with a txt file on the main server that customises the appearance and other variables. It is a commerical product and it is hosted on the main domain.
What I now need to do is somehow check that only the valid domains that are subscribers are allowed to showcase the customised calculator. Each client has their own subdirectory with the text file in them on the same domain as the swf.
The client is given a HTML file that will load their customised calculator into their website, but what we need to do is have some additional information that basically validates that only that domain is hosting the SWF.
Basically I have thought to create a variable &valid_domain in the txt file and append the domain.com value to it. Then, on the client's domain we have a PHP file with a variable $thisDomain = $_SERVER[HTTP HOST]; in it.
But, from there, getting it to post that info to the txt file is where I am a bit confused.
If I just made the txt file a php file and then somehow posted from the client's server to that php file, would that work?
Then I could have an if/else in AS that compares the valid_domain & thisDomain variables.
Am I on the right track here? I am good with Actionscript with everything except the server stuff... it gets a little confusing.
TIA for any help/guidance!
Help With Flash Forms Across Domains
I have a client who wants me to develop a flash ad banner the has forms in it for the user to fill out, and upon submission, will open up a new browser window and show the results on the clients site. The ad banner will be posted on another domain, possibly dynamically.
I've been using Flash since version 3, but never have developed something like this before. Currently I'm using MX 2004. I've read where the cross domain security issues have been tightened for Flash 7. Should the .SWF be in Flash 5 or 6?
My question is, can this be done?
If so, can someone point me in the right direction?
Thanks.
Flash Forms In Ad Banner Across Domains
I have a client who wants me to develop a flash ad banner the has forms in it for the user to fill out, and upon submission, will open up a new browser window and show the results on the clients site. The ad banner will be posted on another domain, possibly dynamically.
I've been using Flash since version 3, but never have developed something like this before. Currently I'm using MX 2004. I've read where the cross domain security issues have been tightened for Flash 7. Should the .SWF be in Flash 5 or 6?
My question is, can this be done?
If so, can someone point me in the right direction?
Thanks.
Checking Filled Out Fields In Flash Forms
Help me!
Here is the code, I want it to check if you have filled out all fields if you have then go to and play this movie clip.
the code is not sending out to php
I really need some help here thanks
ActionScript Code:
stop();
formFlag = false;
if (lastName.text == "" || firstName.text == "" || number.text == "") {
formFlag = true;
}
if (formFlag == false) {
_root.gotoAndStop("form");
} else {
function doSubmit():Void {
//userData = new LoadVars();
_root.name_mc.gotoAndPlay(2);
userData.lastName = lastName.text;
userData.firstName = firstName.text;
userData.zipcode = zipcode.text;
userData.sendAndLoad("http://rgao.netbility.net/register.php?ck="+new Date().getTime(), myFeedback, "POST");
}
var userData:LoadVars = new LoadVars();
var myFeedback:LoadVars = new LoadVars();
myFeedback.onLoad = function() {
if (this.feedback == "OK") {
feedBack_txt.text = this.msg;
} else {
feedBack_txt.text = this.msg;
}
};
}
submit_btn.onRelease = doSubmit;
Invalid Format
Unexpected file format, is the error message I get when opening up a *.fla, file. I have Flash 5. Why do I get this? The file is attached.
Invalid Date
Hi,
I'm trying to comsume a web service with Flash.
However the dates come out as Invalid but they have to be correct since I can use the webservice on other platforms.
Since I cannot control the format the webservice delivers the dates can anyone help me with this?
The bit of code I'm using to test it.
import mx.services.*;
var lLog:Log = new Log (Log.VERBOSE, "myLog");
var lWebService:WebService =
new WebService ("http://webservices.plaintime.com/Service.asmx?wsdl", lLog);
import mx.utils.Delegate;
lWebService.onFault = function () { trace ("WHOOPS!"); }
lWebService.onLoad = Delegate.create (this, _performExampleCall);
function _performExampleCall() {
trace("
Performing example call...");
var lPendingCall:PendingCall = lWebService.DailyTL("");
lPendingCall.onResult = Delegate.create (this, _parseResult);
}
function _parseResult (pResults:Object) {
var aDateate = new Date;
trace(aDate);
var DLTL = pResults.DLTL_Code;
var Start_D = pResults.Start_Date;
var End_D = pResults.End_Date;
trace (Start_D);
trace (End_D);
trace (DLTL);
}
Invalid Argument?
Hi everyone!
I'm getting a bogus error when I run a simple jsfl script... This example just uses timeline.setSelectedLayers, but I get it with a lot other layer based functions when I use the layerIndex.
Anyone else get this problem or know a solution?
Thanks!
Attach Code
layerIndex = timeline.findLayerIndex("Layer 1")
fl.trace("layerIndex: " + layerIndex) // prints layerIndex: 0
timeline.setSelectedLayers(0) // works fine!
timeline.setSelectedLayers(layerIndex) // throws me a ''setSelectedLayers: Argument number 1 in invalid." error! huh?!
FMS License Invalid
Hello everyone,
We have two server. The A server has two licenses, the server B has two licenses, now we want to put 3 licenses on server A and a license on the server B to regulate. But when I put the license number on A server it makes me that the licenses are not valid when they are working very well at this time when ...
got an idea?
Invalid Form Help
Ive managed to build a proper contact form with the help of a few members here at kirupaforum
I was wondering if anyone could help me with a problem im having.
I have 3 input fields on my contact form, name, email, and message (var's). On my "send" button, the actionscript checks to see that if any info in any of those fields is missing, it does not send the email.
I have made a little red text box "Invalid/Missing info" and given it the var "error". What I want to do is have the actionscript check if there is something not filled out on the form, it displays this little error message. Also, I want it to check if there is an "@ and ." symbols typed in the email part of the form, and if there isnt, to display the error message.
Can anyone help me out with this? Ive attached the fla file below.. and it's just about finished, ive even made the error var and everything
Thanks,
Domo
Hmm... seems like hte fla is too big to attach... instead you can grab it here: 66.118.183.203/contactform2.fla
Invalid Appname
hai
I am using red5 in my server to support my flash application.
I've installed red5.But when i give commands to connect my application it gives the error
Invalid appname..
How can i get rid of it..
can anyone help me?
Thanks for response.
Invalid License
Hello to all reading. This is going to be a dumb question with a simple answer more than likely. I am a developer not a graphics person. I have been given a bug where only on the flash images There is an error saying Invalid License. and that is it. I am wondering if this is due to the flash image being created on a version of macromedia or some other editor that was not licensed or the license expired.
Has anyone ever seen this occur to a flash image before?
Invalid Size And Position
I would like to make a menu that scrolls by. (like a marquee). The size is x=3000 and y=50. This would be made into a movieclip. The error message is "invalid size and position". Can I control the size of my workspace/workspace in MX?
I can give an example
http://home.att.net/~timothyrmoore/enter.html
this is the menu at the top that flys by.
Invalid Load Script?
hi
i have the following script on a btn:
on (release) {
_root.number++;
trace(number);
loadMovie(number + ".jpg", 1);
}
where number is a variable in fr1 set to 0. on release changes this to 1. it works. based on this number on release should also load a jpeg entitled 1.jpeg / 2.jpeg / 3.jpeg etc.
i want to load a sequence of jpegs one after the other per each click of the mouse.
it's not working so what am i doing wrong?
Loadvars Invalid Characters Â
Hey,
I am using the loadvars object to send data to my asp page. I have noticed that flash is adding additional characters when sending out data to the page.
For example if I enter "£" into a text field then send it to my page, my page recieves "£".
This is causing a lot of issues for me. For one, I set the maxchars on a text field to 50, the user enters 50 characters. When the asp page receives this data though its more as the addtional  as been added bringing it up to 51 characters, which causes the page to error when trying to insert this data into the database?
Is there anyway to stop flash doing this?
At the moment I have to remove  from every string my page recieves from flash. I have serveral movies using multiple pages.
Thanks
Leah
Object Parameter Is Invalid
This works if get rid of the params object but I need it because I want to pass the info along...why is this giving me an error saying a parameter is invalid when I say params.videoid = "8"...isn't that valid?
Quote:
ArgumentError: Error #2004: One of the parameters is invalid.
ActionScript Code:
var params:Object = new Object();
params.videoid = "8";
var responder:Responder = new Responder(onResult, onFault);
// make the service call
// notice the 3rd. argument..is our object that we are going to send to out method
nc.call( "videoconnect.getDetails", responder, params );
FLVPlayback Invalid Seek
Newbie here.
I'm sure that someone has come across this before, at least I'm hoping. I'm using Flash Player 9, ActionScript 3.0 and I'm bringing in a list of video clips via an XML object. Everything is working... but... I'm getting the following:
VideoError: 1003: Invalid seek
at fl.video::VideoPlayer/seek()
at fl.video::FLVPlayback/seek()
at fl.video::FLVPlayback/seekToNextNavCuePoint()
at fl.video::UIManager/http://www.adobe.com/2007/flash/flvplayback/internal::dispatchMessage()
at fl.video::UIManager/http://www.adobe.com/2007/flash/flvplayback/internal::handleButtonEvent()
I then can either click on the "Dismiss All" or "Continue" button. Since this does NOT cause the next video to NOT play, is there anyway I can force ActionScript 3.0 to ignore this? Or is there something that I should be doing that would prevent this from happening in the first place?
Thanks in advance to everyone... I'm at my wit's end!
FMS 3.0.2 Upgrade, Old License Key Becomes Invalid
We ran into a bug that some users with flash player 9,0,124,0 would not play any H.264 encoded mp4 videos against any FMS 3.0.0. After reading the release notes, we tried to upgrade to FMS 3.0.2. However, the new FMS server would not accept our old license key. What have we done wrong?
Invalid Tincan Object Name
I am trying to stream video from a Flash Media Server using AS3. I am getting an error that I cannot figure out. In my NetStatusEventHandler I am getting event code "NetStream.Play.Failed". The error is: "Invalid tincan object name (stream ID: 1)" This means absolutely nothing to me and I have been unable to find any documentation on the meaning of this error.
ISSUE RESOLVED: I was including the filename in the netconnection.connect method's URI
Invalid Tincan Object Name
I am trying to stream video from a Flash Media Server using AS3. I am getting an error that I cannot figure out. In my NetStatusEventHandler I am getting event code "NetStream.Play.Failed". The error is: "Invalid tincan object name (stream ID: 1)" This means absolutely nothing to me and I have been unable to find any documentation on the meaning of this error.
ISSUE RESOLVED: I was including the filename in the netconnection.connect method's URI
NOTE: I have also posted this in the Flash Media Server forum as I was unsure where this question best fit.
W3C-invalid HTML Output
Hi everyone,
I was very disapointed to notice that if I choose the publish comand in Flash MX 2004 (and set the format at SWF+HTML), I get a "junk" HTML file i.e. the doctype is
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
this is a common and quite unsed W3C doctype. And when I try to check the validity of my page (with the unchanged very output of Flash MX 2004), I get 11 Validation Errors.
Did someone already try to fix them ?
The errors are all the same: telling that the <embed> tag is not declared and should not have such attributes. 1 example:
Quote:
Line 15, column 11: there is no attribute "src"
<embed src="test.swf" quality="high" bgcolor="#ffffff" width="550" height="400"
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.
How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.
The quoted undefined element message is (where DTD means Document Type Definition):
Quote:
element "FOO" undefined
You've used an unknown tag (represented here by "FOO"). Make sure the DTD indicated by your DOCTYPE actually includes this element.
If the tag in question is a frame-related tag you must use the "Frameset" DTD, and if you use (deprecated) physical markup ("FONT" and friends) you must use the "Transitional" DTD.
Thanks for your help
Invalid BitmapData Error - Why?
I have created a document class with this code:
Code:
package {
//
import flash.display.Sprite
import flash.display.BitmapData;
//
public class main extends Sprite {
//
var allData:Array = new Array();
//
public function main() {
var n:int;
for (n=0;n<9000;n++) {
var colour:int = Math.round(Math.random()*0xFFFFFF);
var myBD:BitmapData = new BitmapData(2, 2, false, colour);
allData[n] = myBD;
}
}
}
}
This works fine and creates 9000 BitmapData objects.
However, if you change the loop size to 10000, you will get an Invalid BitmapData error and sometimes (for me anyway) Flash will continually display dialog boxes the content of which I cannot actually see (might be a Vista thing).
Note:all of the code is important - if you comment out the line which assigns the data to the array everything seems to work fine. I've never been more confused...
Anyone got any ideas?
1008: Attribute Is Invalid
Hi,
I tried to implement IEventDispatcher into my own class as below:
PHP Code:
package { /*i removed my import classes for this class for simplicity*/ import flash.utils.EventDispatcher; import flash.utils.IEventDispatcher; public class Viewer extends Sprite implements IEventDispatcher{ private var eventDispatcher:EventDispatcher = new EventDispatcher(); public function Viewer():void{} /*removed my own functions for simplicity*/ public override IEventDispatcher function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void { eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference); } public override IEventDispatcher function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void { eventDispatcher.removeEventListener(type, listener, useCapture); } public override IEventDispatcher function dispatchEvent(event:Event):Boolean { return eventDispatcher.dispatchEvent(event); } public override IEventDispatcher function hasEventListener(type:String):Boolean { return eventDispatcher.hasEventListener(type); } public override IEventDispatcher function willTrigger(type:String):Boolean { return eventDispatcher.willTrigger(type); } }}
problem is, when i run this code i get 1008: Attribute is invalid for all functions being override. I tried googling but was disappointed.
Any help guys thanks!
W3C-invalid HTML Output
Hi everyone,
I was very disapointed to notice that if I choose the publish comand in Flash MX 2004 (and set the format at SWF+HTML), I get a "junk" HTML file i.e. the doctype is
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
this is a common and quite unsed W3C doctype. And when I try to check the validity of my page (with the unchanged very output of Flash MX 2004), I get 11 Validation Errors.
Did someone already try to fix them ?
The errors are all the same: telling that the <embed> tag is not declared and should not have such attributes. 1 example:
Quote:
Line 15, column 11: there is no attribute "src"
<embed src="test.swf" quality="high" bgcolor="#ffffff" width="550" height="400"
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.
How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.
The quoted undefined element message is (where DTD means Document Type Definition):
Quote:
element "FOO" undefined
You've used an unknown tag (represented here by "FOO"). Make sure the DTD indicated by your DOCTYPE actually includes this element.
If the tag in question is a frame-related tag you must use the "Frameset" DTD, and if you use (deprecated) physical markup ("FONT" and friends) you must use the "Transitional" DTD.
Thanks for your help
Invalid Page Fault ?
o/s - win 98 se
IE version 6.02xxxxx
--------------------------
I downloaded and installed
MAcromedia FLASH MX professional DEMO version
The installation proceeded excellenty without a hitch
but when I tried to run it
it says "This program has performed illegal operation"
FLASH caused an invalid page fault in
module FLASH.EXE at 0187:00c45437.
Registers:
EAX=00000000 CS=0187 EIP=00c45437 EFLGS=00010202
EBX=04061530 SS=018f ESP=0131ed20 EBP=0131edac
ECX=00000003 DS=018f ESI=0131ed6c FS=40cf
EDX=00000000 ES=018f EDI=00000094 GS=0000
Bytes at CS:EIP:
a5 a5 a5 a5 8b 75 f0 33 ff 8d 45 c0 50 ff 76 1c
Stack dump:
00000238 00000000 00000204 00006ba8 16c711f1 00000006 bff741f7 00000008 bff7698b bffc94c0 00008d48 bff7152e bff71547 00000000 04061530 fffffffe
any ideas ?
Extension Package Invalid
why does it say when im trying download the mxp. form laco sites
it says this
the extension package is invalid. the extension will not be installed
Invalid Media Data Error - Pls Help
I'm getting an error when trying to play my .swf stating "Couldn't open file because Invalid Media Data was found in Movie". The only thing I've done remotely different is Trace Bitmap on some jpg's I've imported. Pls Help!
Flash MX Invalid Size And Position
Hi all,
Im working in Flash MX, I have a application that is using a sliding background, which is roughly 3950px in width. Problem is that when I start entering the positions for those background images which are over 2880px I start running into problems like Invalid Size and position.
I know files are meant ot have the dimesions 0 to 2880px, why is this?
How do I get around it?
Input Text Invalid Characters
I have an input text field that needs to use only letters and numbers. If someone uses an underscore to separate words, the generated code will cause errors. What I need is a way to check the string for any characters that are not numbers or letters and then display an error message. If I disable the speecial characters, the no space appears ant the code will not be available. So how can I check the string for an underscore. The error part is fine with just and else/if. Thanks for any help.
Unexplainable Invalid BitmapData Error
I have created a document class with this code:
Code:
package {
//
import flash.display.Sprite
import flash.display.BitmapData;
//
public class main extends Sprite {
//
var allData:Array = new Array();
//
public function main() {
var n:int;
for (n=0;n<9000;n++) {
var colour:int = Math.round(Math.random()*0xFFFFFF);
var myBD:BitmapData = new BitmapData(2, 2, false, colour);
allData[n] = myBD;
}
}
}
}
This works fine and creates 9000 BitmapData objects.
However, if you change the loop size to 10000, you will get an Invalid BitmapData error and sometimes (for me anyway) Flash will continually display dialog boxes the content of which I cannot actually see (might be a Vista thing).
Note:all of the code is important - if you comment out the line which assigns the data to the array everything seems to work fine. I've never been more confused...
Anyone got any ideas?
Invalid Tincan Object Name (stream ID: 1)
I'm attempting to stream a video file and my net connection succeeds, but when I try netStream.play(filename), I receive the error 'Invalid tincan object name (stream ID: 1)'
What even is a tincan object, and what issue is there with the name?
My netConnection input is
netConnection.connect('rtmp://'+hostname+'/filepath/filename');
My netStream.play() input is identical to the netConnection input
Invalid HTML Template File ...
in flash MX2004
when updating an HTML template for publishing in ...Flash MX 2004<language>ConfigurationHTML
Flash reports invalid HTML file...
worse : after removing the file from the folder, Flash still reports it as beeing there and invalid!
any suggestion?
Invalid Path Dynamically Created
hi folks,
i have this code,
i experienced that the path does not become usable for the flashplayer, could anybody please tell me why?
i know the if-condition is right and the creation of the variable "retour" works too, i tested that with some trace-actions.
if (this.hitTest(_parent._parent._parent.schieber.schieberhittest)&&_root.schiebergedrueckt==0){
for(i=1;i<8;i++){
retour=eval("button"+i);
_parent._parent._parent.retour.gotoAndStop(1);
}
_parent.gotoAndStop(2);
}
regards
Firegambler
Converting Html Forms To Flash Forms?
i'm in the middle of creating a website for a record company. i've been doing it all in flash, so when they asked me to set up a newsletter facility, i decided it would be in flash. here's my problem:
the host i'm using has a newsletter add/remove facility in html. i've tried converting this into flash but it just wont work! the html form code provided by the hoist (which does work) is below:
<form action='http://cp.cyberstation.co.uk/list.cgi' method='post'>
<input type='hidden' name='list' value='Newsletter'/>
<input type='hidden' name='redirect-success' value='http://www.mickhayglaziers.co.uk/complete.html'/>
<b>Our Mailing List</b><br/>
<input type='text' name='email'/><br/>
<input class='radio' type='radio' name='action' value='add' checked='checked'/>Subscribe
<input class='radio' type='radio' name='action' value='delete'/>Unsubscribe<br/>
<input type='submit' value='Do it Now!'/>
</form>
The actionscript i used on the submit button when converted is:
on (release) {
list="Newsletter";
action="add";
loadVariablesNum ("http://cp.cyberstation.co.uk/list.cgi", "0", "Post");
}
The button is also, along with the list and action variables, on the main timeline!
can anyone offer any insight to where i'm going wrong?
External Text Files And Invalid Characters
I'm calling a bunch of external text files into flash, but they have the % and & signs in them, what can I do to make those symbols actually show up with the swfs are viewed?
Embed Font Linkage, Invalid Identifier
Hi,
I am trying to embed a font in CS3 using the Library> New Font> Linkage technique, but when I try to linkage the MetaPlusNormal-Roman font, I can't because it isn't a valid identifier, I guess because of the '-' symbol.
Ideas are welcome :-),
JerryJ.
ArgumentError: Error #2068: Invalid Sound
i went back and way simplified...
in hopes that it would work... but voila, it doesnt..
so... heres my code.
i made it so you press play to start... but still it doenst work. i get a new error. even tho it traces the url... it cant play it for some reason
Code:
var xmlLoader:URLLoader = new URLLoader();
var playlistURL:URLRequest = new URLRequest('playlist.xml');
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(playlistURL);
var songsXML:XML = new XML();
songsXML.ignoreWhitespace = true;
var song:Sound = new Sound();
song.addEventListener(Event.COMPLETE, songLoaded);
song.addEventListener(ProgressEvent.PROGRESS, progressHandler);
song.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
btnPlay.addEventListener(MouseEvent.MOUSE_UP, buttonPlay);
function buttonPlay(evt:Event):void{
txtArtistName.text = songsXML.song[0].artist;
txtSongName.text = songsXML.song[0].songname;
var songURL:String = String(songsXML.song[0].file);
trace(songURL);
var songRequest :URLRequest = new URLRequest(songURL);
var scChannel:SoundChannel = new SoundChannel();
scChannel = song.play();
song.load(songRequest);
}
function xmlLoaded(evt:Event):void{
songsXML = XML(xmlLoader.data);
//trace(songsXML.song[0].file);
}
function songLoaded(evt:Event):void {
//songURL = songsXML.song[0].file;
}
function progressHandler(evt:Event):void{
trace(song.bytesLoaded + ' : ' + song.bytesTotal);
}
function ioErrorHandler(evt:IOErrorEvent):void{
trace('error: ' + evt.text);
}
please help me. or direct me to an AS3 tutorial for a mp3 player with an XML playlist...
Warning Device Sound Path Is Invalid
I have almost completed my Flash Movie and I notice in the property inspector for a particular sound it says:
"Warning Device Sound Path Is Invalid"
What does this mean and how do I fix it?
Also, If I import a .wav sound file into a flash file then converting it to .mp3 would it matter if I had converted the sound file in a sound editing program to .mp3 first? Would this make the sound files any smaller before Flash interprets them?
Thanks,
Sam
1003: Invalid Seek FLVPlayback Class
I'm using an flv as part of a online training course I'm developing. I don't want the user to be able to fast forward the scrubber in order to skip parts of movie. But of course allowing the user to rewind is ok.
So I thought i'd write some code to do this. I thought i'd just take the playhead time when the user starts scrubbing and compare it to the playhead time when he stops scrubbing. If the playhead time is greater when he stops scrubbing then I just send the user back to the position where he started scrubbing.
ActionScript Code:
listenerObject.scrubStart = function(eventObject:Object):Void {
scrubToggle();
if (scrubSession == false){
scrubStart = eventObject.playheadTime;
}
};
The code above is part of the script I used. The code worked fine until I added an if statement which causes it to throw up an '1003: Invalid seek' error. The flv still plays though.
Anyone know what's going on?
ArgumentError: Error #2068: Invalid Sound.
Hi all,
I recently made an MP3 player by following a tutorial online, it works great offline but it is giving me alot of trouble online. First it was throwing an IO error which I fixed now it is throwing Error #2068. I suspect it has something to do with file size because each MP3 has at least 20 minutes duration.
Here is the document class.
Code:
package {
import flash.events.*;
import fl.events.ListEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class Mp3Main extends MovieClip{
public var url:URLRequest;
public var xmlLoad:URLLoader;
public var musicXML:XML;
public var song:Sound;
public var channel:SoundChannel;
public var sndTrans:SoundTransform;
public var position:Number;
/*The constructor mainly sets up the event listeners, but it also
starts loading the XML playlist file.*/
public function Mp3Main() {
position = 0;
sndTrans = new SoundTransform(vol_mc.percent);
url = new URLRequest("/lectures/lecture.xml");
xmlLoad = new URLLoader(url);
xmlLoad.addEventListener(Event.COMPLETE, xmlComplete);
playList.addEventListener(ListEvent.ITEM_CLICK, SnglClick, false, 0, true);
vol_mc.addEventListener("volume_change", updateVolume, false, 0, true);
seek_mc.addEventListener("seek_change", changeSeekBar, false, 0, true);
/*****************Button Event Listeners************************/
playPause_mc.addEventListener(MouseEvent.MOUSE_OVER, PlayOver);
playPause_mc.addEventListener(MouseEvent.MOUSE_OUT, PlayOut);
playPause_mc.addEventListener(MouseEvent.MOUSE_DOWN, PlayDown);
playPause_mc.addEventListener(MouseEvent.MOUSE_UP, PlayUp);
stop_mc.addEventListener(MouseEvent.MOUSE_OVER, StopOver);
stop_mc.addEventListener(MouseEvent.MOUSE_OUT, StopOut);
stop_mc.addEventListener(MouseEvent.MOUSE_DOWN, StopDown);
stop_mc.addEventListener(MouseEvent.MOUSE_UP, StopUp);
mute_mc.addEventListener(MouseEvent.MOUSE_OVER, MuteOver);
mute_mc.addEventListener(MouseEvent.MOUSE_OUT, MuteOut);
mute_mc.addEventListener(MouseEvent.MOUSE_DOWN, MuteDown);
mute_mc.addEventListener(MouseEvent.MOUSE_UP, MuteUp);
back_mc.addEventListener(MouseEvent.MOUSE_OVER, BackOver);
back_mc.addEventListener(MouseEvent.MOUSE_OUT, BackOut);
back_mc.addEventListener(MouseEvent.MOUSE_DOWN, BackDown);
back_mc.addEventListener(MouseEvent.MOUSE_UP, BackUp);
forward_mc.addEventListener(MouseEvent.MOUSE_OVER, ForwardOver);
forward_mc.addEventListener(MouseEvent.MOUSE_OUT, ForwardOut);
forward_mc.addEventListener(MouseEvent.MOUSE_DOWN, ForwardDown);
forward_mc.addEventListener(MouseEvent.MOUSE_UP, ForwardUp);
}
/*This function is used to display the minutes and seconds of the current song.
It is only used in the updateSeek() function.*/
public function formatTime(time:Number):String {
var min:String = Math.floor(time/60000).toString();
var sec:String = (Math.floor((time/1000)%60) < 10)? "0" + Math.floor((time/1000)%60).toString() : Math.floor((time/1000)%60).toString();
return(min+":"+sec);
}
/***********************Event Handlers****************************/
/*I want to start loading the first song right after filling the
List component. If you want it to play automaticly, here is where
you do that.*/
private function xmlComplete(event:Event):void {
var item:Object;
musicXML = new XML(event.currentTarget.data);
for each(var prop:XML in musicXML.song){
item = new Object();
item.label = prop.@disp;
item.data = prop.@id;
playList.addItem(item);
}
song = new Sound();
song.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
song.load(new URLRequest(playList.getItemAt(0).data));
this.addEventListener(Event.ENTER_FRAME, updateSeek, false, 0, true);
playList.selectedIndex = 0;
}
/*When you choose a new item on the List it will play for you.*/
private function SnglClick(event:ListEvent):void {
var item:Object = event.item;
try
{song.close();}
catch(error)
{}
try
{channel.stop();}
catch(error)
{}
song = new Sound();
song.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
song.load(new URLRequest(item.data));
channel = song.play();
channel.soundTransform = (mute_mc.isMute)? new SoundTransform(0) : sndTrans;
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete, false, 0, true);
position = 0;
playPause_mc.playing = true;
playPause_mc.gotoAndStop('pause');
}
/*When a song ends, this will take you to the next song.*/
private function soundComplete(event:Event):void {
if(playList.length > playList.selectedIndex + 1){
playList.selectedIndex++;
playList.scrollToSelected();
} else {
playList.selectedIndex = 0;
playList.scrollToSelected();
}
playList.dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, 0, playList.selectedIndex, playList.selectedIndex, playList.selectedItem));
}
/*The next two are called handling custom events from within SeekControl.as
and VolControl.as*/
private function updateVolume(event:Event):void {
sndTrans.volume = vol_mc.percent;
channel.soundTransform = (mute_mc.isMute)? new SoundTransform(0) : sndTrans;
}
private function changeSeekBar(event:Event):void {
position = (song.length/(song.bytesLoaded/song.bytesTotal)) * seek_mc.percent;
if(playPause_mc.playing){
channel.stop();
channel = song.play(position);
channel.soundTransform = (mute_mc.isMute)? new SoundTransform(0) : sndTrans;
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete, false, 0, true);
}
}
private function updateSeek(event:Event):void {
if(channel != null && playPause_mc.playing) {
var perc:Number = channel.position / (song.length/(song.bytesLoaded/song.bytesTotal));
seek_mc.moveSeekPos(perc);
display_mc.timeDisp.text = formatTime(channel.position) + "/" + formatTime((song.length/(song.bytesLoaded/song.bytesTotal)));
display_mc.timeDisp.text = formatTime(position) + "/" + formatTime((song.length/(song.bytesLoaded/song.bytesTotal)));
}else {
}
}
private function ioErrorHandler(event:Event):void {
trace("ioErrorHandler: " + event);
}
/*******************PlayPause Handlers*************************/
private function PlayOver(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.playing) {
obj.gotoAndStop('pause_over');
} else {
obj.gotoAndStop('play_over');
}
}
private function PlayOut(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.playing) {
obj.gotoAndStop('pause');
} else {
obj.gotoAndStop('play');
}
}
private function PlayDown(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.playing) {
obj.gotoAndStop('pause_down');
} else {
obj.gotoAndStop('play_down');
}
}
/*Needs to switch between a pause and play button.*/
private function PlayUp(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.playing) {
obj.gotoAndStop('play_over');
position = channel.position;
channel.stop();
obj.playing = false;
} else {
obj.gotoAndStop('pause_over');
channel = song.play(position);
channel.soundTransform = (mute_mc.isMute)? new SoundTransform(0) : sndTrans;
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete, false, 0, true);
obj.playing = true;
}
}
/********************Stop Handlers************************/
private function StopOver(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('stop_over');
}
private function StopOut(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('stop');
}
private function StopDown(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('stop_down');
}
/*Needs to change the Play button as well.*/
private function StopUp(event:MouseEvent):void {
var obj:Object = event.currentTarget;
channel.stop();
position = 0;
playPause_mc.playing = false;
playPause_mc.gotoAndStop('play');
obj.gotoAndStop('stop_over');
}
/********************Mute Handlers************************/
private function MuteOver(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.isMute) {
obj.gotoAndStop('unmute_over');
} else {
obj.gotoAndStop('mute_over');
}
}
private function MuteOut(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.isMute) {
obj.gotoAndStop('unmute');
} else {
obj.gotoAndStop('mute');
}
}
private function MuteDown(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.isMute) {
obj.gotoAndStop('unmute_down');
} else {
obj.gotoAndStop('mute_down');
}
}
private function MuteUp(event:MouseEvent):void {
var obj:Object = event.currentTarget;
if(obj.isMute) {
obj.gotoAndStop('mute_over');
obj.isMute = false;
channel.soundTransform = sndTrans;
} else {
obj.gotoAndStop('unmute_over');
obj.isMute = true;
channel.soundTransform = new SoundTransform(0);
}
}
/********************Back Handlers************************/
private function BackOver(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('back_over');
}
private function BackOut(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('back');
}
private function BackDown(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('back_down');
}
/*changes the List selection and then dispatches a fake ITEM_CLICK event.*/
private function BackUp(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('back_over');
if(channel.position < 1500){
if(playList.selectedIndex == 0){
playList.selectedIndex = playList.length -1;
playList.scrollToSelected();
} else {
playList.selectedIndex--;
playList.scrollToSelected();
}
playList.dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, 0, playList.selectedIndex, playList.selectedIndex, playList.selectedItem));
}else {
try
{channel.stop();}
catch(error)
{}
position = 0;
if(playPause_mc.playing) {
channel = song.play(0);
channel.soundTransform = (mute_mc.isMute)? new SoundTransform(0) : sndTrans;
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete, false, 0, true);
}
}
}
/********************Forward Handlers************************/
private function ForwardOver(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('forward_over');
}
private function ForwardOut(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('forward');
}
private function ForwardDown(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('forward_down');
}
/*changes the List selection and then dispatches a fake ITEM_CLICK event.*/
private function ForwardUp(event:MouseEvent):void {
var obj:Object = event.currentTarget;
obj.gotoAndStop('forward_over');
if(playList.length > playList.selectedIndex + 1){
playList.selectedIndex++;
playList.scrollToSelected();
} else {
playList.selectedIndex = 0;
playList.scrollToSelected();
}
playList.dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, 0, playList.selectedIndex, playList.selectedIndex, playList.selectedItem));
}
}
}
Domains
Who do you all think is the best to buy a high bandwidth/space domain name with relatively low prices?
I've never bought a .com b4...
I'd appreciate your thoughts on this.
Two Domains
Oke the following:
movie1:
Has a layer with as:
System.security.allowDomain("http://mysite2.com/");
and a layer with as in frame1:
unique = new Date().getTime();
productid = "1001";
myVars = new LoadVars();
myVars.loadok = "1";
myVars.sendAndLoad("welcome.php?" + unique, myVars);
myVars.onLoad = function(success){
if(success){
_root.loader.loadMovie("http://www.mysite2.com/movie2.swf");
} else {
GotoAndStop (4);
}
}
stop();
Movie2 has the following as and is loaded in the mc with instance name "loader":
myCheck = new LoadVars();
myCheck.loadok = "1";
myCheck.sentnukeurl = _root.myVars.nukeurl;
myCheck.sentsitename = _root.myVars.sitename;
myCheck.sentproductid = _root.productid;
myCheck.sendAndLoad("http://www.mijnsite2.nl/check.php?" + unique, myCheck);
myCheck.onLoad = function(ok){
if(ok){
productidc = _root.loader.myCheck.productid;
sitenamec = _root.loader.myCheck.sitename;
nukeurlc = "Test";
admincontrolc = _root.loader.myCheck.admincontrol;
//trace(nukeurlc);
_root.gotoAndStop(2);
}
}
After this te main movie goes to frame 2. This is a keyframe and in this also the mc loader is placed. There is also a mc in this frame and layer with dynamische text with fieldname title1. This should diplay the var from movie2 sitename with the following as:
onClipEvent (enterFrame) {
title1.text = _root.loader.myCheck.sitename;
}
But I get an undefined....
Does anyone know why???
A New Way To Get Across Domains
Is it posible to write some javaScript code to dynamically load text data (specifically an RSS feed) into a HTML doccument, which has a flash movie embeded into it, then us FScommand to pass those variable into flash?
I'm asking because i have been using PHP work arounds for ages, but now the 'other' sites are starting to realise that there are loads of requests comming from my server, so it would be good to move the calling of the URI to be client side.
any thoughts?
Xl
XML Across Domains
I have a project that sends queries to a database and receives XML formatted data:
Markets_xml = new XML();
Markets_xml.onLoad = readMarketsXML;
Markets_xml.load("
Trace Bitmap Gets Invalid Media Data Error
I've imported jpg's into my movie and did a Trace Bitmap effect...then convert to Graphic Symbols...then Test Movie is fine....BUT when I go to try swf all by itself I get an Error "Couldn't open file because Invalid Media Data was found in Movie" There is nothing in the least bit fancy in this movie...Please Help!
Placing Mcs Offstage: Invalid Size And Position Error
i have a series of mcs that i want to place one after the other inside a container mc so i can then scroll this horizontally.
the last mc needs to be placed way offstage at x: 3000+ and flash is giving me an error message.
i'm sure there are much better ways of doing this than setting it up manually. any help would be hugely appreciated! thanks.
Set Input Text Feild To 0 If Invalid Character Entered
Hi
Need some help with actionscript 2.0
I have set up a shopping cart and need the Quantity input feilds to automatically reset to 0 if a character that is not a number is entered.
Hopefully this is not too complicted!! (there are 5 quantity input feilds)
Adobe's Youtube API Lib Throwing An Invalid Dev_id Error
i'm getting an error when trying to connect to YouTube with my dev key. I've tried three different, newly generated keys to no avail. (I've removed them for security issues).
ActionScript Code:
// custom imports
import gs.TweenLite;
import com.adobe.webapis.youtube.*;
import com.adobe.webapis.youtube.events.*;
import com.adobe.webapis.youtube.methodgroups.*;
// constants
const YOUTUBE_APIKEY:String = "<key removed>";
const YOUTUBE_USER:String = "chi2016";
const YOUTUBE_URLWWW:String = "www.youtube.com";
const YOUTUBE_URLGDATA:String = "gdata.youtube.com";
// variables
var yt:YouTubeService;
// security
Security.allowDomain( YOUTUBE_URLWWW );
Security.allowDomain( YOUTUBE_URLGDATA );
Security.allowInsecureDomain( YOUTUBE_URLWWW );
Security.allowInsecureDomain( YOUTUBE_URLGDATA );
Security.loadPolicyFile( "http://gdata.youtube.com/crossdomain.xml" );
// set up the Youtube stuff
initYoutube();
//---------------------------------------------------------------------------------------------------------------------------------
function initYoutube():void
{
ta.text += "initYoutube()----------
";
yt = new YouTubeService( YOUTUBE_APIKEY );
ta.text += " yt = " + yt.apiKey + "
";
yt.addEventListener( YouTubeServiceEvent.VIDEOS_LIST_BY_USER, onVideosListByUser );
yt.videos.listByUser( YOUTUBE_USER );
}
//---------------------------------------------------------------------------------------------------------------------------------
function onVideosListByUser( evt:YouTubeServiceEvent ):void
{
ta.text += "onVideosListByUser()----------
";
ta.text += " event = " + evt + "
";
ta.text += " target = " + evt.target + "
";
ta.text += " data = " + evt.data + "
";
for( var $i:String in evt.data )
ta.text += " i = " + evt.data[$i].errorCode + " - " + evt.data[$i].errorMessage;
// evt.data.VideoList should contain the array of videos?
}
and here's the output in the TextArea component (ta):
Code:
initYoutube()----------
yt = <key removed>
onVideosListByUser()----------
event = [Event type="onListByUser" bubbles=false cancelable=false eventPhase=2]
target = [object YouTubeService]
data = [object Object]
i = 8 - Bad, unknown, or disabled dev_id specified.
anybody got any ideas why the youtube api is returning an error?
Not Allowing User To Enter Invalid Char To TextInput
Hi,
I want to make a control when user press any key and if it's a String ('a','z' etc.),cancelling this KeyboardEvent but if it is a number ('6','9',etc),not cancel this KeyboardEvent.But i realize that KeyboardEvents can not cancelled.Can i change the charCode of this event,or what should I do?
Thanks.
Free .com Domains
Always wanted a free .com domain name???
Well here's a chance....im not spamming.....i just want to spread the word.
goto ********freedomain.biz and u can get a .com or .net or .org for one year free!!!!! no hidden costs(i tried them myself).
Tell me whatchya think of that!
|