[F8] Adding Eventlistener To Geturl After A Specific Flv Is Finnish Playing
my evenlistener is able to get a url after my video player finish playing
but i need it to be specific after the dvd.flv video finish the function is executed please see coding below, i would appreciate some help
stop();
attachMovie("FLVPlayback", "myplayer", 1);
myplayer._x = 415;
myplayer._y = 203.1;
myplayer._width = 320;
myplayer._height = 240;
myplayer.autoPlay = true;
myplayer.activePlayControl = true;
myplayer.controllerPolicy = "on";
myplayer.totalTime = 0;
myplayer.bufferTime = 3;
myplayer.autoSize = true;
myplayer.skinAutoHide = false;
myplayer.maintainAspectRatio = true;
myplayer.volume = 110;
myplayer.playButton = playbtn;
myplayer.pauseButton = pausebtn;
myplayer.backButton = backbtn;
myplayer.muteButton = mutebtn;
myplayer.seekBar = seekbtn;
//myplayer.volumeBar = volumebtn;
//myplayer.bufferingBar = BufferBar;
myplayer.contentPath = "videos/dvd.flv";
video1_mc.onRelease = function() {
myplayer.contentPath = "videos/interview.flv";
};
video2_mc.onRelease = function() {
myplayer.contentPath = "videos/dvd.flv";
};
var displayListener:Object = new Object();
displayListener.complete = function() {
getURL("http://www.woolworths.co.uk/ww_p2/product/index.jhtml?pid=50787969");
};
myplayer.addEventListener("complete", displayListener);
video3_mc.onRelease = function() {
myplayer.contentPath = "videos/Demoreel.flv";
};
FlashKit > Flash Help > Flash ActionScript
Posted on: 01-16-2007, 04:22 PM
View Complete Forum Thread with Replies
Sponsored Links:
EventListener Function Specific To Generated Display Object Container
This has to be simple, if only I knew how. I'm an AS3 newbie, and am having difficulty setting up multiple specific EventListeners within a code generated display object container.
I am generating a 'page' (Sprite) with a heap of 'cards' (Sprites) on it. Each of those cards, in turn, contains a selection of text boxes and other objects generated from database output using a 'for' loop.
My hope is to attach an EventListener to each 'card' so that a MouseEvent will let me manipulate the data that lead to the content of that actual card (the i-th iteration of my for loop). I've been playing with everything I can think of (limited repertoire of thoughts though) and the best I've managed is for my EventListener to access the final set of data, whichever 'card' I click on.
I've summarised and attached my code for the function, and would appreciate any advice (however basic) on how to get back to the i-set of data from the EventListener attached to the i-th card. I can handle the PHP and MySQL side of things but am fumbling my way into the OOP of AS3.
Cheers
Dougal
Attach Code
function reviewPageMode(n, reviewRequirements, cardsRequired)
{
//make the reviewPage display object container
var reviewPage:Sprite = new Sprite();
reviewPage.buttonMode = false;
addChild(reviewPage);
// sort out all the variables
var commentBox:TextField = new TextField();
reviewPage.addChild(commentBox);
// build the cards and text boxes and add them to the reviewPage
for (var i:int = 1; i < (cardsRequired+1); i++)
{
// setup the locations for all the objects
var displayCard:Sprite = new Sprite();
displayCard.buttonMode = true;
displayCard.opaqueBackground = 0xFFFFFF;
displayCard.addEventListener(MouseEvent.CLICK, accessThisData, false, 0, true);
reviewPage.addChild(displayCard);
function accessThisData(evt:MouseEvent):void
{
// I want to be able to do stuff to the data that was used
// in generating the i set of displayCards and textFields
}
var firstTextBox:TextField = new TextField();
displayCard.addChild(firstTextBox);
var secondTextBox:TextField = new TextField();
displayCard.addChild(secondTextBox);
// etc etc etc
}
}
View Replies !
View Related
AS3: Adding Parameter To EventListener
hi everybody.
i'd like to know how to pass a parameter to my function through an eventListener.
to illustrate, I've made this example:
http://campjohn.dk/AS3/addingParamet...ntListener.swf
by clicking the boxes on the left, the bigBox centrered changes color.
nice!
right now, I have to use a if else-loop:
Code:
//imports
import caurina.transitions.Tweener;
this.blueBox.addEventListener(MouseEvent.CLICK, changeColor);
this.redBox.addEventListener(MouseEvent.CLICK, changeColor);
this.yellowBox.addEventListener(MouseEvent.CLICK, changeColor);
function changeColor(e:Event):void {
trace("CLICKED: e.target.name = "+e.target.name);
if(e.target.name == "blueBox"){
Tweener.addTween(this.bigBox, {_color:0x0000FF, time:1, transition:"linear"});
trace("changing color to blue");
} else if(e.target.name == "redBox") {
Tweener.addTween(this.bigBox, {_color:0xFF0000, time:1, transition:"linear"});
trace("changing color to blue");
} else if(e.target.name == "yellowBox") {
Tweener.addTween(this.bigBox, {_color:0xFFFF00, time:1, transition:"linear"});
trace("changing color to blue");
} else {
trace("this shouldn't be possible");
}
}
can I somehow change the example above so it passes the color to use to the function as a parameter instead?
thanks
felisan
View Replies !
View Related
AS3: Adding Parameter To EventListener
hi everybody.
i'd like to know how to pass a parameter to my function through an eventListener.
to illustrate, I've made this example:
http://campjohn.dk/AS3/addingParamet...ntListener.swf
by clicking the boxes on the left, the bigBox centrered changes color.
nice!
right now, I have to use a if else-loop:
Code:
//imports
import caurina.transitions.Tweener;
this.blueBox.addEventListener(MouseEvent.CLICK, changeColor);
this.redBox.addEventListener(MouseEvent.CLICK, changeColor);
this.yellowBox.addEventListener(MouseEvent.CLICK, changeColor);
function changeColor(e:Event):void {
trace("CLICKED: e.target.name = "+e.target.name);
if(e.target.name == "blueBox"){
Tweener.addTween(this.bigBox, {_color:0x0000FF, time:1, transition:"linear"});
trace("changing color to blue");
} else if(e.target.name == "redBox") {
Tweener.addTween(this.bigBox, {_color:0xFF0000, time:1, transition:"linear"});
trace("changing color to blue");
} else if(e.target.name == "yellowBox") {
Tweener.addTween(this.bigBox, {_color:0xFFFF00, time:1, transition:"linear"});
trace("changing color to blue");
} else {
trace("this shouldn't be possible");
}
}
can I somehow change the example above so it passes the color to use to the function as a parameter instead?
thanks
felisan
View Replies !
View Related
AS3: Adding Parameter To EventListener
hi everybody.
i'd like to know how to pass a parameter to my function through an eventListener.
to illustrate, I've made this example:
http://campjohn.dk/AS3/addingParameterToEventListener/addingParameterToEventListener.swf
by clicking the boxes on the left, the bigBox centrered changes color.
nice!
right now, I have to use a if else-loop:
Code:
//imports
import caurina.transitions.Tweener;
this.blueBox.addEventListener(MouseEvent.CLICK, changeColor);
this.redBox.addEventListener(MouseEvent.CLICK, changeColor);
this.yellowBox.addEventListener(MouseEvent.CLICK, changeColor);
function changeColor(e:Event):void {
trace("CLICKED: e.target.name = "+e.target.name);
if(e.target.name == "blueBox"){
Tweener.addTween(this.bigBox, {_color:0x0000FF, time:1, transition:"linear"});
trace("changing color to blue");
} else if(e.target.name == "redBox") {
Tweener.addTween(this.bigBox, {_color:0xFF0000, time:1, transition:"linear"});
trace("changing color to blue");
} else if(e.target.name == "yellowBox") {
Tweener.addTween(this.bigBox, {_color:0xFFFF00, time:1, transition:"linear"});
trace("changing color to blue");
} else {
trace("this shouldn't be possible");
}
}
can I somehow change the example above so it passes the color to use to the function as a parameter instead?
thanks
felisan
View Replies !
View Related
Trouble Adding Eventlistener In Loop
I'm having trouble adding this eventlistener in a simple loop. Can somebody tell, why the eventhandler doesn't get triggered?
Code:
// handler
function countryHandler(e:MouseEvent)
{
trace(e.currentTarget.name);
}
// add eventlistener loop
for (var i:Number = 0; i < isoCountriesArr.length; i++)
{
var tempId:String = isoCountriesArr[i];
if (map_mc.getChildByName(tempId) != null)
{
var tempCountryMc:MovieClip = MovieClip(map_mc.getChildByName(tempId));
countryArray.push(tempCountryMc)
tempCountryMc.addEventListener(MouseEvent.CLICK, countryHandler);
}
}
View Replies !
View Related
Adding Eventlistener At Runtime, Error #1006
Hii guys
I'm a newbie in AS3 working with flex
I have a custom control named as Frame
I'm adding a event listener to frame object
and have to call the function for event handling
where I want the objFrame, where I could do some functioning
on it
I dont know how to add a listener to a object at runtime n calling the
listener function and passing some values to it.
Below is my code
I'm getting the error
TypeError: Error #1006: value is not a function.
at presentation/FrameClick()[E:aFlex workspaceCreatorsrcpresentation.mxml:82]
plz help me out
its urgent
some function
{
for(var intD:int=0;intD<intNoOfFrames;intD++)
{
var objTmpFrame:Frame=new Frame();
objTmpFrame.height=intHeight;
objTmpFrame.width=intWidth;
strFrameId="FrameNo:"+(intD+1);
objTmpFrame.id=strFrameId;
objTmpFrame.graphics.beginFill(0x0000ff);
objTmpFrame.addEventListener(MouseEvent.CLICK,Fram eClick); //adding the
//listener at runtime n calling the function frameclick
MainMiddleVbox.addChildAt(objTmpFrame,intD);
}
lblCurrentFrame.text="Frame:1";
}
private function FrameClick(event:MouseEvent):void
{
LINE:82 var objCurrentFrame:Frame=event.currentTarget() as Frame;
var objAmanda:amanda=new amanda();
}
thanks in advanx
View Replies !
View Related
Adding EventListener MouseEvent Click To Existing Mc Which Aleady Has Alpha Motion...
hi, my name's jude and i'm an author designing a site for my new publishing company. i want to use a flash button on the site and am having problems finding the right actionscript. i'm a total nOOb in actionscript but i promise i've done lots of research into this - however the only tutes i can find are for starting from scratch making movie clip buttons.
all i want to do is add the actionscript for a mouse click which takes you to the desired URL, to this existing code controlling the motion of the movie clip.
onClipEvent(load)
{
dir = 0;
speed = 6;
original._alpha = 0
this.onRollOver = function()
{
dir = 1;
}
this.onRollOut = function()
{
dir = -1;
}
useHandCursor = true;
}
onClipEvent(enterFrame)
{
temp = original._alpha + speed*dir;
original._alpha = Math.min(100,Math.max(temp,0));
}
you can see the completed .swf (before i changed the HandCursor to true) here.
and here are screenshots of the relevant pages in flash
http://i250.photobucket.com/albums/g...reenshot-1.jpg
http://i250.photobucket.com/albums/g...reenshot-2.jpg
http://i250.photobucket.com/albums/g...in/scene-1.jpg
- i would be so grateful for any help from you guys (and, i presume, girls!) - many thanks in advance.
View Replies !
View Related
The Movie Start To Play Before It Finnish Loading
I have a flv file on a flash server and I use NetConnection and NetStream to load the movie into my flash.
I have
Code:
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
mcbuff._visible = false;
clearInterval(videoInterval);
txtloadingtext._visible=false;
mcmovie._visible = true;
}
function videoStatus() {
loading = Math.round(ns.bufferLength/2* 100);
if (loading<100){
txtloadingtext.text = loading + " %";
}
}
videoInterval = setInterval(videoStatus,10);
so when the buffer is full is going to show that movieclip that have the player inside(mcmovie) but someway it start to play before the loading is 100 and that dont look good when I have a animation and text on the movie (mcbuff and txtloadingtext)
View Replies !
View Related
GetURL To Specific Frame?
I'm in movieA. I set up the links for a button to go to movieB by commanding getURL (which I do all the time in Flash 5). However, it will only take me to frame 1 of movieB. Is there anyway I can get the movieA button to link directly to, say, frame 6 of movieB?
If Flash MX (and not Flash 5) has a function that will do it, what is the command?
View Replies !
View Related
GetURL With Specific Frame (possible?)
Can I use the GetURL to go to a specific frame on another swf? Since I have my Nav page on the last frame of the Intro swf and I don't want to play the Intro everytime someone tries to get back to the Nav page. If it's possible, please show me how or post me a link to it. Or if there are other ways to do this, please let me know. Thanks.
View Replies !
View Related
GetURL To Specific Frame In Different SWF
Hello,
I basically trying to open up a SWF, click on a button within it that brings up a second SWF, and I'd like for the second SWF to go to a specific frame. The solutions I've tried aren't working.
My problem is this isn't working. Here's my code:
Flash file #1, button #1:
code:
on (release) {
getURL("javascriptpenNewWindow('test.html','thew in','height=575,width=700,toolbar=no,scrollbars=no ') ");
gotoAndStop("warmup");
}
In the HTML for Flash file #1, I placed this, just about the </HEAD> tag:
code:
<SCRIPT LANGUAGE=JavaScript>
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
</SCRIPT>
And I should mention, that I've added frame labels to all of the scenes, so technically, I'm trying to go to the labels (which are in frame 1 of each scene, and are named differently).
The popup window comes up just fine, but only to the first frame.
If someone could post the correct code, I'd appreciate it.
Thanks.
Stephen
View Replies !
View Related
GetURL To Specific Frame
Hi. Just a quick question.
Is there a way of using getURL to open another flash file on a specified frame?
The only thing is, I'd like it to go via the preloader.
Maybe it makes more sence to be able to pass a variable over. So when u click the button it sends you to the other page/file, but sends a variable with it. So as soon as the preloader is complete it goes to the relevant frame according to what the variable is.
wo! I have a way of over complicating things in words.
any ideas?
View Replies !
View Related
GetURL->specific Window (title)?
Here's the layout:
Main site got login button that opens new window to login.
Now I want the login site to show new content/file (using getURL) in the previous window (containing main site).
The manual says something about entering the title, played around a bit but didn't figure it out.
View Replies !
View Related
GetURL Into A Specific Frame Of An HTML Page
I want to switch html pages that are loaded into specific frames in a browser window out side the main window that the flash movie is in.
In other words:
I click a button in the flash movie that is located in the Main window of a framed window and I want it to change out the html page in the Top, Bottom or Side frames. Without opening a new window.
Can I do this using the getURL command and if so how do I specify the
designated frame in the window?
I tried coping the same code that I am using in HTML now.
But it only opens a new window instead of just loading the html page in to the designated frame.
BELOW IS AN EXAMPLE OF WHAT I AM TRYING TO ACHEIVE AND NOT .
YOU WILL SEE A RED TOP AND A FLASH BLACK BUTTON.
CLICK THE BUTTON AND A NEW WINDOW OPENS WITH A GREEN TOP.
I WANT THE GREEN ONE TO REPLACE THE RED ONE.
http://www.homesofstillwater.com/test2.html
Any help would be much appreciated,
cyberhues
View Replies !
View Related
Playing MC At Specific Times Of Day
I have two videos I want to play, one video will always play and the other will play depending on the time. I would like to store the time information in an external file. I'd to have it setup so It will play from 9:00am to 9:30am then after 9:30 it will go back to the default or main video.
This information has to be in an external file so the receptionist can change the times, daily.
Is there away to set it up like this. In the text file there is one variable. var=sometime for video_2 e.g.(9am-10am)
In the .fla file there are 2 frames, frame one with video_1 and frame 2 with video_2. By default video_1 would play unless it's the time specified range in the text file, then it would go to frame 2 and play video_2.
Thanks in advance, dandormix
View Replies !
View Related
Playing A Specific Frame In Another Swf.
I have two seperate .swf files. The first calls the second using loadMovieNum();. Now, when a user presses a button in the second swf to unload that movie, I then want to go to a specific frame in the first swf.. all in the same action.
Is there any way to do this? A simplified example for the code I am imagining is this (applied to the button in the second swf that I want to both unload that movie, AND go to a specific frame in the first swf):
Code:
on (press) {
this.unloadMovie();
gotoAndPlay("First SWF", frame);
}
If so, could someone please let me know? Help would be greatly appreciated.
View Replies !
View Related
Playing Specific FLV's In List
I've got the following script working correctly. When button1 is clicked it populates a list with XML driven items. When each list item is selected the description is presented in a text area. All good.
I'm having trouble however, with playing a specific FLV when the item is clicked in the list. I can get it to work by specifying a specific vid.source = ("http......") by I need each item to play a different FLV.
Any help appreciated.
button1.addEventListener(MouseEvent.CLICK,play1);
lb.setStyle("contentPadding", 0);
function play1(e:Event):void {
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
lb.addEventListener(Event.CHANGE, itemChange);
function itemChange(e:Event):void
{
ta.text = lb.selectedItem.data;
import fl.video.*;
var vid:FLVPlayback;
vid = new FLVPlayback();
vid.scaleMode = VideoScaleMode.EXACT_FIT
vid.x = 70;
vid.y = 68;
vid.width = 401;
vid.height = 226;
addChild(vid);
}
var xml:XML;
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
var il:XMLList = xml.track;
for(var i: uint=0; i<il.length(); i++)
{
lb.addItem ({data:il.creator.text(),
label:il.title.text()});
}
}
loader.load(new URLRequest("
View Replies !
View Related
Playing Specific Frames Only?
Hey all,
I'm trying to loop only five or so frames from an entire movie clip, and I'm not quite sure how to do this.
Basically I have a man walk in and sit down as an intro scene (frames 1-6), and then from there playing just looping the 'sitting' animations (frames 7-11) until the user does something with the interface. can someone point me to a tutorial or help me out?
Thanks.
View Replies !
View Related
Playing To A Specific Frame.
I had a thought and i'm not sure how to go about this.
Lets say i had an animation and i also had four buttons.
The animation would have 4 frame labels at different areas of the timeline. For example:
"Label 1" "Label 2" "Label 3" "Label 4"
now if i'm on the "Label 1" frame and i hit button 3. I'd like to have the animation play until it reaches "Label 3". Also if I were at "Label 4" and hit button 1, I would want it to play backwards to "Label 1" OR maybe it could either play through to the end and loop back depending on which way is closer.
I don't know if this is really possible. I know each labeled frame would require a stop() action, but i'm not sure how to make something play until it reaches a specified destination frame.
Any ideas?
View Replies !
View Related
[AS2] Playing A Specific Frame
I am using the following actionscript to load a external swf. I would like to actually start playing that movie at a specific location based on what is already loaded. I am using this tutorial here. Its hard to explain exactly what I want but basically lets say I have three swf's. A, B, C.
If I go from A to B I use this AS
Code:
B_bt.onRelease = function() {
if (_root.currMovie == undefined) {
_root.currMovie = "B"; container.loadMovie("B.swf");
} else if (_root.currMovie != "B") {
if (container._currentframe>=container.midframe) {
_root.currMovie = "B"; container.play(); }
}
};
Which is fine. If I go from A to C I use basically the same AS just change the "B" to a "C". In each case (going from A to B and from A to C) I am ok with them starting to play on the first frame. But if I go from C to B I actually want B to start at a different frame then when I went from A to B. Is there a way to change the AS to do that?
I am also using this AS to load a movie right off the bat.
Code:
_root.currMovie = "A";
container.loadMovie(_root.currMovie+".swf");
Can I change that to A start at a particular location.
I hope this all makes sense
Thanks,
Josh
View Replies !
View Related
Playing Only Specific Frames Problem
I've searched on the forums and have not found a solution so hopefully this isn't too much of a request for help.
On my main timeline I have a movie clip which within it consists of a 60 frame animation. Now on the main timeline are buttons which when clicked I would like to play that movie clip.
Now here is my problems or questions. If you press, say button 1 it will play the entire animation. Now if you press button 2 I would like for it to play only the first 30 frames and then stop and stay at frame 30 of the animation. From what I gather I don't think there is a stop command in the mc on frame 30 or the button 1 function would never play all 60 frames. I have the button 1 code to be:
on (release){
_mc.gotoAndPlay(1);
};
button 2?
on (release){
_mc.gotoAndPlay(1);
if(30){
stop();
}
};
Please help I am at a loss.
View Replies !
View Related
How Do I Stop A Specific Sound Playing?
I'm sure the answer must be very simple but I'm having difficult figuring it out. I have two sounds, 'cranes' and 'drumroll'. I have two buttons, one which triggers cranes and one which triggers drumroll. So far so good, everything works.
However, I want to make it so that if the drumroll is still playing when the cranes sound starts playing, the drumroll stops. Likewise I want the cranes sound to stop playing when the drumroll starts.
I've pasted the code below; would be much obliged for any help...
Code:
//SET UP SOUNDS
var reqCranes:URLRequest = new URLRequest("cranes.mp3");
var sCranes:Sound = new Sound(reqCranes);
var reqDrumroll:URLRequest = new URLRequest("drumroll.mp3");
var sDrumroll:Sound = new Sound(reqDrumroll);
//CLICKABLE AREA INSTRUCTIONS
button1.addEventListener(MouseEvent.CLICK, cranes);
button2.addEventListener(MouseEvent.CLICK, drumroll);
//LAUNCH SOUNDS
function cranes(event:MouseEvent):void {
var channelCranes:SoundChannel = sCranes.play();
//Code I want here: stop the drumroll sound
}
function drumroll(event:MouseEvent):void {
var channelDrumroll:SoundChannel = sDrumroll.play();
//Code I want here: stop the cranes sound
}
View Replies !
View Related
Stopping A Playing MC At A Specific Frame Without
Last edited by jturuc : 2004-03-08 at 09:50.
What I want to have happen is when you mouse down on the button/MC the block_mc will first jump to frame 40 and then it needs to check and stop when the block_mc reaches frame 12. I have attached a simplified version of what I was trying to do
on the first keyframe I have
ActionScript Code:
stop();
_root.block_mc.onEnterFrame = function() {
_root.blockFrame = _root.block_mc._currentframe;
};
on the mc that has a button nested inside of it I have
ActionScript Code:
onClipEvent (enterFrame) {
if (_root.blockFrame == 12) {
_root.block_mc.stop();
}
}
on the button that is inside the MC I have
ActionScript Code:
on (release) {
_root.block_mc.gotoAndPlay(40);
}
View Replies !
View Related
Adding My .as Files To Specific Areas On My Stage
I'm fairly new to ActionScript 3.0 and I have been learning from books and online tutorials. I feel like I am getting the hang of the .as files and have made a few 3D objects that I would like to display on my time line/in my final movie. Here's an example of what I mean:
I made Cabinet3D.as, which uses Triangle.as, Points3D.as and Light.as to build and "light" a 3D video game cabinet. If I add Cabinet3D to the Document class box, it works just like I want it to, but now I want to add 3 of these cabinets to the stage, in 3 specific spots, and have them as a background as users interact with the rest of the site.
How do I get them on to the stage, specifically where I want them?
I uploaded .fla files, but they're really .as files, if they help. Thanks in advance for any help.
View Replies !
View Related
Detecting If MC Loaded Then Playing From A Specific Frame
Hello,
I've searched the net without much luck. I need a little help loading a movie clip. Basically I have 10 buttons and one external movie clip that is to be loaded to _root.container.cont. Each button is to play a section in the mc so I need to detect if the movie clip is loaded firstly and then gotoAndPlay frame 5 for button 5, frame 6 for button 6, etc. If the mc is not loaded I need the button to load my mc and start playing from the frame specified. I want to do it this way so I don't have to load 10 different movie clips and so my preloader animation doesn't activate if the mc is loaded. I know this sounds a bit complicated, any ideas or tricks?
Cheers
View Replies !
View Related
[F8] Playing Sounds In A User Specific Order
I've got an issue here, that I honestly can't figure out how to resolve. For class I have to make an interactive poem that the user can select any line of the poem at a time. How I was thinking of doing this was to have five movie clips each with the word "Line" and the number that it corrosponds with, and five place holders that you drag the line movie clips to. What I would like to do is have external sound files play in the order the user selects. Any ideas?
View Replies !
View Related
Playing Specific Frames Of The Timeline Using Actionscript 3.0
hi,
i am new to actionscrpt and i need to know if it possible to use script (like go to and play (2-25)), or maybe some combination of functions or something???to play specific frames of the main timeline and then stop and wait for further instructions?
i'm trying to design a game that uses 1 timeline instead of a more standard layout with bunch of different movie clips, stops, and go to and play() etc..
if such a code exists i could just put everything on 1 timeline and play the frames i want.
does that even make sense?
any ideas would be much appreciated.
thanks
mike
View Replies !
View Related
Jumping To Specific Frames Within 1 Scene And Playing (help Please)
I have one scene with many frames, and i want to jump to a series of different frames within the time line (in this case, frames: 2,86,171,256,341,426,511)
and then play from there. So at start of movie it will start in a different random position and play through, in order - then looping.
I have this but I know it is totally wrong, it wasn't designed to do what I want:
Quote:
// define a array with all your previously defined labels
labelarray=[2,86,171,256,341,426,511];
// calculate a random index for this array
randomidx = random(labelarray.length);
// jump to the label at the random index
gotoAndPlay(labelarray[randomidx]);
Any help greatly appreciated
I'm sure it can't be that hard... but I've had no luck and been trying for a while now
EDIT (this is something else I came with, hat doesnt work either...)
Quote:
num = Math.floor(Math.random() * (6 - 1)) + 1;
//Depending on which random number
//was chosen, go to a flash scene
if (num = 0)
{
gotoAndPlay(2)
}
if (num = 1)
{
gotoAndPlay(86)
}
if (num = 2)
{
gotoAndPlay(171)
}
if (num = 3)
{
gotoAndPlay(256)
}
if (num = 4)
{
gotoAndPlay(341)
}
if (num = 5)
{
gotoAndPlay(426)
}
if (num = 6)
{
gotoAndPlay(511)
}
View Replies !
View Related
Playing Movie Clips In Specific Layers
I'm loading a movieclip (a jpg) into my SWF but i'd like to specify the layer it goes to as i have buttons in my SWF that i'd like to be active whilst the movieclip is playing.
My code is
_root.createEmptyMovieClip("box",1);
_root.box.createEmptyMovieClip("pic_mc",2);
_root.box.pic_mc._x = 0;
_root.box.pic_mc._y = 0;
_root.box.pic_mc.loadMovie(imgLoc);
From reading up a lot I've found that the second parameter in the createEmptyMovieClip command is meant to be the layer but changing this number seems to do nothing, does anyone have any ideas?
cheers
Greg
View Replies !
View Related
Audio Not Playing When Played From A Specific Location
Hi,
I have been trying to build play/pause functionality in Actionscript 3.0. It usually works fine, but seems to skip audio when i try to play sound from a particular location.
Basically, play/pause works fine till only half the total length of audio has played, but afterwards it just jumps to the last location and calls sound complete handler. Not sure if I am doing anything incorrectly.
Can there be anything wrong with the audio file that I am using? Any thoughts and pointer would be highly appreciated.
TarXXXXXX
Attach Code
package {
import flash.display.Sprite;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.events.*;
import flash.text.TextFieldAutoSize;
public class SoundChannel_stopExample extends Sprite {
private var snd:Sound = new Sound();
private var channel:SoundChannel = new SoundChannel();
private var button:TextField = new TextField();
public function SoundChannel_stopExample(_this:Object) {
var req:URLRequest = new URLRequest("sample.mp3");
snd.load(req);
button.x = 10;
button.y = 10;
button.text = "PLAY";
button.border = true;
button.background = true;
button.selectable = false;
button.autoSize = TextFieldAutoSize.CENTER;
button.addEventListener(MouseEvent.CLICK, clickHandler);
_this.addChild(button);
snd.addEventListener(Event.COMPLETE, completeHandler);
}
private function clickHandler(e:MouseEvent):void {
var pausePosition:int = channel.position;
if(button.text == "PLAY") {
trace("Sound start : " + channel.position);
channel = snd.play(pausePosition);
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
button.text = "PAUSE";
}
else {
trace("Sound stop : " + channel.position);
channel.stop();
button.text = "PLAY";
}
}
private function soundCompleteHandler(e:Event):void {
trace("Sound complete : " + channel.position);
button.text = "PLAY";
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + snd.length);
}
}
}
View Replies !
View Related
Playing A Timeline In Reverse Until A Specific Frame?
Okay, I have been working on putting a flash portfolio together and I have come to a problem point, and thought I could seek help here. A big thanks to anyone that helps me solve this rather simple (i think) problem.
Here's the problem. I have a movieclip that is comprised of multiple images. These images are used as the backdrops of various different pages of my portfolio.
Every image is in a specific order, so if the user decides to go from page 1 to page 4, it will pan through the first three pages quickly before stopping on the 4th page. Simple Enough.
The problem is I want them to be able to also do this while manipulating the timeline in reverse. So say if they're on page 4 and want to go back to page 2, it will 'rewind' the timeline and stop on page 2.
I know there are plenty of tutorials out on how to play a timeline in reverse, however none of which discuss stopping automatically when reaching a certain point that is before the beginning.
If anyone has any suggestions please let me know! I was considering perhaps using if/then statements to keep it moving when it hits one of the stop points, however I'm not very advanced with actionscripting and have only really just started learning it.
Thanks for help!
Michael Wesley Stratton
View Replies !
View Related
Adding Movieclips With Addchild And A Loop...how To Target A Specific One?
I have this code:
----------------------------------------------------
for(var i:Number = 0; i < 10; i++) {
buttonVar = new button();
addChild(buttonVar);
buttonVar.x = i*120;
}
----------------------------------------------------
It creates a 10 movieclips and moves them apart 120 units, what I want is to target a specific created movie clip. Say for example the number 4 in the loop, how can I asign a specific instance to that movieclip? to differentiatte it from the other ones ? any idea ?
View Replies !
View Related
Adding An Event Listener On A Specific Area In A Video..
Hello everybody,
I am sure this is supposed to be very simple. I want to use only ActionScript (No editing through CS4).
All I want to do is to place some sort of mouse click event listener on a certain area (that I tried defining with a shape object).
Lets say the video is 640x480. So I want a shape where the 4 point are (100,150), (120,150), (150,150) and (90,150).
I want to trace a message when the user clicks inside that area.
Thanks!!!!!
OML
View Replies !
View Related
Adding A GetURL To A Button
I'm new, and I was wondering if someone could help me with Flash MX.
I am trying to make a nice little flashy navigation bar for my website, and I'm fine with making buttons and all, but only I have one problem.
On a little test button I made for fun, I was able to add a getURL thing to it no problem, but now, with the button I've properly made (graphics in photoshop) I can't add a getURL because it's all grey and nonselectable.
I have no idea what I'm doing now, and it's driving me insane .... please help!
View Replies !
View Related
Adding A PHP Tag To The GetURL Action?
Hello, you all. I have a question for all you action-script guru’s because I do not have a clue!
The Marketing dept. here at work have decided they need track clicks from webmasters having unique ID numbers from the existing Flash nav. Say that a surfer arrives at a page from an address such as:
http://www.somesite.com/index.html?revid=1014
To include this extension to a normal HTML anchor tag, it would look like so:
<A HREF="join.html<? revid(); ?>"onClick="exit=false"></A>
Originally, one of the Flash nav links simply stated;
on (release) {
getURL("join.html");
}
Including this to my existing Flash navigation via the getURL action, I learned is a different story! The output window shows errors up-the-yang.
on (release) {
getURL("join.html<? revid(); ?>, onClick=exit=false");
}
This did not work too well!
So, the questions are…where does one include this nested PHP tag in the actionScript? Also, where…and how to include the exit pop-up script, "onClick="exit=false?"
Could someone PLEASE school me?
Thank you so much!
Dorian~
View Replies !
View Related
Adding A PHP Tag To The GetURL Action?
Hello, you all. I have a question for all you action-script guru’s because I do not have a clue!
The Marketing dept. here at work have decided they need track clicks from webmasters having unique ID numbers. Whereas a normal HTML anchor tag would contain this line;
<A HREF="join.html<? revid(); ?>"onClick="exit=false"></A>
Originally, one of the Flash nav links simply stated;
on (release) {
getURL("join.html");
}
Including this to my existing Flash navigation via the getURL action, I learned is a different story! The output window shows errors up-the-yang.
on (release) {
getURL("join.html<? revid(); ?>, onClick=exit=false");
}
This did not work too well!
So, the questions are…where does one include this nested PHP tag in the actionScript? Also, where…and how to include the exit pop-up script, "onClick="exit=false?"
Could someone PLEASE school me?
Thank you so much!
Dorian~
View Replies !
View Related
Button Script For Playing Specific Frame Sequence?
I am working on a piece for language learning. I have a scene constructed with a block of text and a sound track on the timeline (someone reading the text). The sound file is set to stream. I have stop script in frame 1. I have buttons that start and stop the play.
Now I want to create some buttons that will play short sections of the time line (just a few frames)that represent one word of the sound(i.e., the user clicks the button and hears only one word pronounced). I can make a button with script that goes to a specific frame and begins play there. However, I can't seem to devise script for making the play stop on a specified frame. I don't want to put stop script on the timeline because the play will always stop at that frame. I want the stop to work only when the button for a single word is clicked. Can someone help me with the script?
View Replies !
View Related
Playing Movie Clip Backwards To A Specific Frame
Hi guys,
I´ve looked in the forum for threads regarding playing a flash timeline backwards. As a matter or fact, I´ve found plenty of them... However, all of them just teaches us how to tell flash to go from the last frame to the first frame of the movie. What I need is to find a whay to tell flash to run backwards to a specific frame.
Best regards!
View Replies !
View Related
Button Playing Specific Frame In Attached Movieclip
Hi: New to flash and really need help with this-
I've attached 2 movie clips with:
this.attachMovie("saltanswer", "f", 0, {_x:200, _y:200});
this.attachMovie("salt", "f", 1, {_x:200, _y:200});
I have a button within one of the attached movies (linkage is "salt") that I want to call to a frame within the other attached movie ("saltanswer"). Right now all I have is actionscript directly on the button:
on (release) {
gotoAndPlay ("saltanswer", "wrong1");
}
I get no errors but it just seems like the button doesn't know the path to the specific frame- right now the path is the linkage name, and the frame label I want it to go to.
anyone have any idea how to remedy this? I'm looking to finish this up ASAP so if anyone can help me that'd be great!
Happy holidays
View Replies !
View Related
|