Triggering Events After The Last Object Loads
I have a site where every page consists of a navigation .swf and a .jpg background.
I'm looking for a way to trigger an event after both have loaded. Some backgrounds are larger than their nav counterparts and visa versa so I can't predetermine which one should check on the other. Any ideas on how I can just have the last item to load trigger the event?
FlashKit > Flash Help > Flash ActionScript
Posted on: 02-01-2006, 02:02 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Triggering An Event When An Image Loads...
Hello there.
I've had a good look around the forum - and Flash Help has once again not been very helpful.
I'm just trying to have a function triggered when a certain amount of images have loaded. I've tried so many variations (including copying code from here) but it's not working!
Here's what I've got...(excluding the image-loading code).
var mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(){
imagesLoaded ++;
trace(imagesLoaded);
if (imagesLoaded == 4) {
images.title.start_btn._visible = true;
loader._visible = false;
};
};
mcl.addListener(mclListener);
Is there anything wrong with that? When 4 images have loaded, it's supposed to make the 'start' button visible, but no go so far.
I've tried using 'onLoadComplete' instead, but from some comments on-line it sounds like that might behave a bit unpredictably.
If anyone can help me out, that'd be great.
Triggering Events
Hello
I have a MovieClip with an On(Press) event.
I want to trigger this event without the user actualy pressing. can it be done?
Thanks
Triggering FLV Events
Howdy, i have the following Problem
I have a FLV called: TEST.FLV
It has 2 Cuepoints inside. One is called Bumper and one is called Downer.
How can i get two MCs called MyBumper and MyDowner to play when the certain Cuepoint is reached???
I have tried to understand the builtin help from Flash, but i have no clue ... Any help much appreciated ...
thanxin advance
ChromeD
Q: Carousel 2 - Triggering Events
Hey I was hoping someone could go a little beyond this excellent tut and explain how to fire events from the icon in
Code:
function released()
I tried authoring custom .swf but simply adding an
Code:
on (release) {
//Movieclip GotoAndPlay Behavior
this.gotoAndPlay("n");
//End Behavior
}
inside a button or creating a movieclip that functions like a button > publish > include in xml > test carousel app, doesnt seem to work.
at any rate this (and quite frankly all) tutorial is excellent, high marks to the entire community :)
I have a content workflow using swift 3d plugin for max7, i have a design that i have been wanting to pull off for months now and finally this code and example gives me the framework for my art...
you guys rock, lee you are a king among men.
Triggering Events From Movie Clips
Here's my scenario. I want to have a button that when clicked will trigger a movie clip right next to it that acts as a drop down menu. On the drop down menu will be eight different buttons that when clicked will take the viewer to eight different scenes. I'm sure there is an easy solution to it, but I keep stumbling on going from the buttons in the movie clip to the different scenes. Any help is EXTREMELY appreciated. Thanks!
BUTTON STATES - Triggering Events
I am using FLash MX, and am applying an action to a button so that the timline jumps to a different part of the same MC depending on what state the button is in.
My MC is called over_out.
My frame labels are called "out", "over", "click"
What I need is code that will say...
On rollover, make my MC (over_out) jump to frame label "over" and on rollout, make the same MC jump to "out". On press, make the same MC jump to "click"
If the MCis at the frame label "click" then I want to cancel my previous request to jump to the frame label "out" on rollout and "over" on rollover.
I want my MC to stay on "click" whether I move over or out of the hitstate of the button.
However on my second click of the mouse cancel the above and allow my movie to jump to "over" on rollover and "out" on rollout.
When the mouse is clicked over the hitstate AGAIN let the above apply again...and so on.
IE: One mouse click, stays on "click", 2nd mouse click allows the rollover and out to work again.
Does anyone know how to say the above in actionscripting???
My attempted Code below (that doesn't work, the MC doesn't stay at click when I rollover or out):
on (rollOver) {
over_out.gotoAndPlay("over");
}
on (rollOut) {
over_out.gotoAndPlay("out");
}
on (press, release, releaseOutside) {
over_out.gotoAndStop("click");
}
Listening For 2 Events Before Triggering ONE Function
What is the best way to handle an object listening for 2 events before executing ONE function? (and I don't want the function to execute twice)
In my case, I want a request to be made for some data to load at the same time that an exit animation is playing. Before I want my intro animation to occur, I need the data to load AND the exit animation to be done! Two separate events! I know I could make it so the data request is not made UNTIL the exit animation is done, but that seems wasteful. Why should an animation hold up a data request, they are mutually exclusive, but the intro animation depends on them both! please advise, thanks!
Triggering Events On Two Overlapped Objects
Say I have two rectangular sprites B(bigger) and S(smaller) overlapped, with S (the smaller one) on top.
They are both listening to the MouseEvent.MOUSE_MOVE event.
But when mouse-overing within the range of S, B stops responding to the MOUSE_MOVE event.
How can I get *both* the objects listening still even one is overlapping the other?
Thanks.
Triggering Events In Fla When XML Has Loaded In Class
Hi,
I have my xml loading through a class file (XMLClass.as) and when the loading is complete it sets the xml as a variable called xmldata.
The xml is a track list and I want tracks to begin playing when the user enters the site but as the data takes time to load, the data is empty if it is set immediately. The code beneath works by collecting the xml variable on a mouse click event but can someone please tell me how I can add an event to be triggered as soon as the class file has loaded the xml so I can set the track list variable inside the fla and start playing the track immediately?
I've been sifting through the Flash help and had a look for other articles but I can't really define a term that summarises what I'm looking for.
Code:
var XMLData:XMLClass = new XMLClass();
var mydata:XMLList;
gettrack_btn.addEventListener(MouseEvent.CLICK, getXML);
function getXML(event:MouseEvent):void {
mydata = XMLData.xmldata;
trace(mydata.child('title')[0]);
}
Many thanks,
Dan
Triggering Events On Two Overlapped Objects
Say I have two rectangular sprites B(bigger) and S(smaller) overlapped, with S (the smaller one) on top.
They are both listening to the MouseEvent.MOUSE_MOVE event.
But when mouse-overing within the range of S, B stops responding to the MOUSE_MOVE event.
How can I get *both* the objects listening still even one is overlapping the other?
Thanks.
SetInterval Not Triggering Events Based On FLV
Hello,
This is my first post to the forum so, I apologize for any mistakes. I've inherited a project that plays an FLV that streams and events are triggered when certain points are reached based on the video by using the "switch" method. As the FLV is played, a "setInterval" function checks the time every second to see how many seconds have elapsed, which then triggers certain events to happen. The issue is that certain events aren't being triggered; however, there have been instances where all of the events are triggered. Is there a way to create some kind of check to guarantee that every event is triggered? The alternative solution that I have come up with would be to tween all of the needed "events" frame-by-frame, as oppose to how it is now, which is using only 2 frames. Thank you in advance.
ActionScript Code:
var time_interval:Number = setInterval (checkTime, 1000, netStrm);
// Function to check time based on "time_interval" variable
function checkTime (myVideo_ns:NetStream) {
var ns_seconds:Number = myVideo_ns.time;
var minutes:Number = Math.floor (ns_seconds / 60);
var seconds = Math.floor (ns_seconds % 60);
var totalSeconds = (minutes * 60) + seconds;
if (seconds < 10) {
seconds = ("0" + seconds);
}
time_mc.timeTextBox_txt.text = minutes + ":" + seconds;
// Trigger animations based on seconds elapsed
switch (totalSeconds) {
case 1 :
//loadAnim_mc._visible = false;
cctbLogo_mc._visible = false;
myVideo_mc.alphaTo (100,(animSpeed * 2),animType);
loadAnim_mc.alphaTo (0,animSpeed,animType);
updateAfterEvent ();
break;
case 23 :
//netStrm.pause ();
myVideo_mc.alphaTo (0,(animSpeed * 1.5),animType);
updateAfterEvent ();
break;
case 24 :
myVideo_mc._x = 665;
myVideo_mc._y = 155;
myVideo_mc.alphaTo (100,(animSpeed * 2),animType);
//netStrm.pause ();
updateAfterEvent ();
break;
case 29 :
animScrnIn (hmPg_mc,315,155,100,100);
updateAfterEvent ();
break;
case 42 :
animScrnOut (hmPg_mc);
updateAfterEvent ();
break;
case 45 :
mrktGuidesTxt_mc.gotoAndPlay ("anim");
textIn (mrktGuidesTxt_mc,xForText,yForText - 90);
updateAfterEvent ();
break;
case 47 :
//textOut (mrktGuidesTxt_mc);
templatesTxt_mc.gotoAndPlay ("anim");
textIn (templatesTxt_mc,xForText,yForText - 30);
updateAfterEvent ();
break;
case 48 :
//textOut (templatesTxt_mc);
elementsTxt_mc.gotoAndPlay ("anim");
textIn (elementsTxt_mc,xForText,yForText + 30);
updateAfterEvent ();
break;
case 49 :
chiContentTxt_mc.gotoAndPlay ("anim");
textIn (chiContentTxt_mc,xForText,yForText + 90);
updateAfterEvent ();
break;
case 60 :// Clear text call-outs
textOut (mrktGuidesTxt_mc);
textOut (templatesTxt_mc);
textOut (elementsTxt_mc);
textOut (chiContentTxt_mc);
updateAfterEvent ();
break;
case 64 :
richBaseTxt_mc.gotoAndPlay("anim");
textIn (richBaseTxt_mc,xForText,yForText - 40);
updateAfterEvent ();
break;
case 69 :
textOut (richBaseTxt_mc);
webcastsTxt_mc.gotoAndPlay ("anim");
textIn (webcastsTxt_mc,xForText,yForText - 90);
updateAfterEvent ();
break;
case 75 :
webcastsTxt_mc.xSlideTo (xForText - 80,animSpeed,animType);
textIn (emailTxt_mc,xForText - 130,yForText - 50);
updateAfterEvent ();
break;
case 77 :
textIn (womTxt_mc,xForText - 130,yForText - 0);
updateAfterEvent ();
break;
case 79 :
textIn (andMoreTxt_mc,xForText - 130,yForText + 50);
updateAfterEvent ();
break;
case 85 :
textOut (webcastsTxt_mc);
textOut (emailTxt_mc);
textOut (womTxt_mc);
textOut (andMoreTxt_mc);
updateAfterEvent ();
break;
case 90 :
animScrnIn (hmPg2_mc,280,170,100,75);
updateAfterEvent ();
break;
case 96 :
animBtnIn (hmPg2_mc.ad_mc,-264,-40);
updateAfterEvent ();
break;
case 98 :
animBtnIn (hmPg2_mc.web_mc,-132,-40);
updateAfterEvent ();
break;
case 100 :
animBtnIn (hmPg2_mc.mar_mc,0,-40);
updateAfterEvent ();
break;
case 102 :
animBtnIn (hmPg2_mc.pr_mc,132,-40);
updateAfterEvent ();
break;
case 104 :
animBtnIn (hmPg2_mc.city_mc,264,-40);
updateAfterEvent ();
break;
case 106 :
placeClip (hmPg2_mc.ad_mc,0,-40);
hmPg2_mc.ad_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.web_mc,152,-40);
placeClip (hmPg2_mc.mar_mc,264,-40);
placeClip (hmPg2_mc.pr_mc,-264,-40);
placeClip (hmPg2_mc.city_mc,-152,-40);
updateAfterEvent ();
break;
case 115 :
hmPg2_mc.ad_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,0,-40);
placeClip (hmPg2_mc.web_mc,132,-40);
placeClip (hmPg2_mc.mar_mc,264,-40);
placeClip (hmPg2_mc.pr_mc,-264,-40);
placeClip (hmPg2_mc.city_mc,-132,-40);
updateAfterEvent ();
break;
case 117 :
placeClip (hmPg2_mc.web_mc,0,-40);
hmPg2_mc.web_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.mar_mc,152,-40);
placeClip (hmPg2_mc.pr_mc,264,-40);
placeClip (hmPg2_mc.city_mc,-264,-40);
placeClip (hmPg2_mc.ad_mc,-152,-40);
updateAfterEvent ();
break;
case 125 :
hmPg2_mc.web_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,-132,-40);
placeClip (hmPg2_mc.web_mc,0,-40);
placeClip (hmPg2_mc.mar_mc,132,-40);
placeClip (hmPg2_mc.pr_mc,264,-40);
placeClip (hmPg2_mc.city_mc,-264,-40);
updateAfterEvent ();
break;
case 127 :
placeClip (hmPg2_mc.mar_mc,0,-40);
hmPg2_mc.mar_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.pr_mc,152,-40);
placeClip (hmPg2_mc.city_mc,264,-40);
placeClip (hmPg2_mc.ad_mc,-264,-40);
placeClip (hmPg2_mc.web_mc,-152,-40);
updateAfterEvent ();
break;
case 131 :
hmPg2_mc.mar_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,-264,-40);
placeClip (hmPg2_mc.web_mc,-132,-40);
placeClip (hmPg2_mc.mar_mc,0,-40);
placeClip (hmPg2_mc.pr_mc,132,-40);
placeClip (hmPg2_mc.city_mc,264,-40);
updateAfterEvent ();
break;
case 133 :
placeClip (hmPg2_mc.pr_mc,0,-40);
hmPg2_mc.pr_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.city_mc,152,-40);
placeClip (hmPg2_mc.ad_mc,264,-40);
placeClip (hmPg2_mc.web_mc,-264,-40);
placeClip (hmPg2_mc.mar_mc,-152,-40);
updateAfterEvent ();
break;
case 145 :
hmPg2_mc.pr_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,264,-40);
placeClip (hmPg2_mc.web_mc,-264,-40);
placeClip (hmPg2_mc.mar_mc,-132,-40);
placeClip (hmPg2_mc.pr_mc,0,-40);
placeClip (hmPg2_mc.city_mc,132,-40);
updateAfterEvent ();
break;
case 147 :
placeClip (hmPg2_mc.city_mc,0,-40);
hmPg2_mc.city_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.ad_mc,152,-40);
placeClip (hmPg2_mc.web_mc,264,-40);
placeClip (hmPg2_mc.mar_mc,-264,-40);
placeClip (hmPg2_mc.pr_mc,-152,-40);
updateAfterEvent ();
break;
case 155 :
hmPg2_mc.city_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,152,-40);
placeClip (hmPg2_mc.web_mc,264,-40);
placeClip (hmPg2_mc.mar_mc,-264,-40);
placeClip (hmPg2_mc.pr_mc,-132,-40);
placeClip (hmPg2_mc.city_mc,0,-40);
updateAfterEvent ();
break;
case 156 :
animScrnOut (hmPg2_mc);
updateAfterEvent ();
break;
case 158 :
animScrnIn (hmPg_mc,315,155,100,100);
updateAfterEvent ();
break;
case 160 :
mostPopDL_mc._visible = true;
mostPopDL_mc.gotoAndPlay (2);
updateAfterEvent ();
break;
case 161 :
hmPg_mc._visible = false;
updateAfterEvent ();
break;
case 166 :
animScrnOut (mostPopDL_mc);
myVideo_mc.alphaTo (0,(animSpeed * 2),animType);
updateAfterEvent ();
break;
case 167 :
myVideo_mc._x = 405;
myVideo_mc._y = 155;
myVideo_mc.alphaTo (100,(animSpeed * 2),animType);
updateAfterEvent ();
break;
case 194 :
netStrm.pause ();
netStrm.seek (0);
playback_mc.gotoAndStop ("paused");
playBoolean = false;
myVideo_mc.alphaTo (0,(animSpeed * 2),animType);
cctbLogo_mc._visible = true;
cctbLogo_mc.alphaTo (100,(animSpeed * 2),animType);
updateAfterEvent ();
break;
}
updateAfterEvent ();
}
// Play NetStream
netStrm.play (_root.flvFile);
stop ();
SetInterval Not Triggering Events Based On FLV
This is my first post to the forum so, I apologize for any mistakes. I've inherited a project that plays an FLV that streams and events are triggered when certain points are reached based on the video by using the "switch" method. As the FLV is played, a "setInterval" function checks the time every second to see how many seconds have elapsed, which then triggers certain events to happen. The issue is that certain events aren't being triggered; however, there have been instances where all of the events are triggered. Is there a way to create some kind of check to guarantee that every event is triggered? The alternative solution that I have come up with would be to tween all of the needed "events" frame-by-frame, as oppose to how it is now, which is using only 2 frames. Thank you in advance.
Code:
var time_interval:Number = setInterval (checkTime, 1000, netStrm);
// Function to check time based on "time_interval" variable
function checkTime (myVideo_ns:NetStream) {
var ns_seconds:Number = myVideo_ns.time;
var minutes:Number = Math.floor (ns_seconds / 60);
var seconds = Math.floor (ns_seconds % 60);
var totalSeconds = (minutes * 60) + seconds;
if (seconds < 10) {
seconds = ("0" + seconds);
}
time_mc.timeTextBox_txt.text = minutes + ":" + seconds;
// Trigger animations based on seconds elapsed
switch (totalSeconds) {
case 1 :
//loadAnim_mc._visible = false;
cctbLogo_mc._visible = false;
myVideo_mc.alphaTo (100,(animSpeed * 2),animType);
loadAnim_mc.alphaTo (0,animSpeed,animType);
updateAfterEvent ();
break;
case 23 :
//netStrm.pause ();
myVideo_mc.alphaTo (0,(animSpeed * 1.5),animType);
updateAfterEvent ();
break;
case 24 :
myVideo_mc._x = 665;
myVideo_mc._y = 155;
myVideo_mc.alphaTo (100,(animSpeed * 2),animType);
//netStrm.pause ();
updateAfterEvent ();
break;
case 29 :
animScrnIn (hmPg_mc,315,155,100,100);
updateAfterEvent ();
break;
case 42 :
animScrnOut (hmPg_mc);
updateAfterEvent ();
break;
case 45 :
mrktGuidesTxt_mc.gotoAndPlay ("anim");
textIn (mrktGuidesTxt_mc,xForText,yForText - 90);
updateAfterEvent ();
break;
case 47 :
//textOut (mrktGuidesTxt_mc);
templatesTxt_mc.gotoAndPlay ("anim");
textIn (templatesTxt_mc,xForText,yForText - 30);
updateAfterEvent ();
break;
case 48 :
//textOut (templatesTxt_mc);
elementsTxt_mc.gotoAndPlay ("anim");
textIn (elementsTxt_mc,xForText,yForText + 30);
updateAfterEvent ();
break;
case 49 :
chiContentTxt_mc.gotoAndPlay ("anim");
textIn (chiContentTxt_mc,xForText,yForText + 90);
updateAfterEvent ();
break;
case 60 :// Clear text call-outs
textOut (mrktGuidesTxt_mc);
textOut (templatesTxt_mc);
textOut (elementsTxt_mc);
textOut (chiContentTxt_mc);
updateAfterEvent ();
break;
case 64 :
richBaseTxt_mc.gotoAndPlay("anim");
textIn (richBaseTxt_mc,xForText,yForText - 40);
updateAfterEvent ();
break;
case 69 :
textOut (richBaseTxt_mc);
webcastsTxt_mc.gotoAndPlay ("anim");
textIn (webcastsTxt_mc,xForText,yForText - 90);
updateAfterEvent ();
break;
case 75 :
webcastsTxt_mc.xSlideTo (xForText - 80,animSpeed,animType);
textIn (emailTxt_mc,xForText - 130,yForText - 50);
updateAfterEvent ();
break;
case 77 :
textIn (womTxt_mc,xForText - 130,yForText - 0);
updateAfterEvent ();
break;
case 79 :
textIn (andMoreTxt_mc,xForText - 130,yForText + 50);
updateAfterEvent ();
break;
case 85 :
textOut (webcastsTxt_mc);
textOut (emailTxt_mc);
textOut (womTxt_mc);
textOut (andMoreTxt_mc);
updateAfterEvent ();
break;
case 90 :
animScrnIn (hmPg2_mc,280,170,100,75);
updateAfterEvent ();
break;
case 96 :
animBtnIn (hmPg2_mc.ad_mc,-264,-40);
updateAfterEvent ();
break;
case 98 :
animBtnIn (hmPg2_mc.web_mc,-132,-40);
updateAfterEvent ();
break;
case 100 :
animBtnIn (hmPg2_mc.mar_mc,0,-40);
updateAfterEvent ();
break;
case 102 :
animBtnIn (hmPg2_mc.pr_mc,132,-40);
updateAfterEvent ();
break;
case 104 :
animBtnIn (hmPg2_mc.city_mc,264,-40);
updateAfterEvent ();
break;
case 106 :
placeClip (hmPg2_mc.ad_mc,0,-40);
hmPg2_mc.ad_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.web_mc,152,-40);
placeClip (hmPg2_mc.mar_mc,264,-40);
placeClip (hmPg2_mc.pr_mc,-264,-40);
placeClip (hmPg2_mc.city_mc,-152,-40);
updateAfterEvent ();
break;
case 115 :
hmPg2_mc.ad_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,0,-40);
placeClip (hmPg2_mc.web_mc,132,-40);
placeClip (hmPg2_mc.mar_mc,264,-40);
placeClip (hmPg2_mc.pr_mc,-264,-40);
placeClip (hmPg2_mc.city_mc,-132,-40);
updateAfterEvent ();
break;
case 117 :
placeClip (hmPg2_mc.web_mc,0,-40);
hmPg2_mc.web_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.mar_mc,152,-40);
placeClip (hmPg2_mc.pr_mc,264,-40);
placeClip (hmPg2_mc.city_mc,-264,-40);
placeClip (hmPg2_mc.ad_mc,-152,-40);
updateAfterEvent ();
break;
case 125 :
hmPg2_mc.web_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,-132,-40);
placeClip (hmPg2_mc.web_mc,0,-40);
placeClip (hmPg2_mc.mar_mc,132,-40);
placeClip (hmPg2_mc.pr_mc,264,-40);
placeClip (hmPg2_mc.city_mc,-264,-40);
updateAfterEvent ();
break;
case 127 :
placeClip (hmPg2_mc.mar_mc,0,-40);
hmPg2_mc.mar_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.pr_mc,152,-40);
placeClip (hmPg2_mc.city_mc,264,-40);
placeClip (hmPg2_mc.ad_mc,-264,-40);
placeClip (hmPg2_mc.web_mc,-152,-40);
updateAfterEvent ();
break;
case 131 :
hmPg2_mc.mar_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,-264,-40);
placeClip (hmPg2_mc.web_mc,-132,-40);
placeClip (hmPg2_mc.mar_mc,0,-40);
placeClip (hmPg2_mc.pr_mc,132,-40);
placeClip (hmPg2_mc.city_mc,264,-40);
updateAfterEvent ();
break;
case 133 :
placeClip (hmPg2_mc.pr_mc,0,-40);
hmPg2_mc.pr_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.city_mc,152,-40);
placeClip (hmPg2_mc.ad_mc,264,-40);
placeClip (hmPg2_mc.web_mc,-264,-40);
placeClip (hmPg2_mc.mar_mc,-152,-40);
updateAfterEvent ();
break;
case 145 :
hmPg2_mc.pr_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,264,-40);
placeClip (hmPg2_mc.web_mc,-264,-40);
placeClip (hmPg2_mc.mar_mc,-132,-40);
placeClip (hmPg2_mc.pr_mc,0,-40);
placeClip (hmPg2_mc.city_mc,132,-40);
updateAfterEvent ();
break;
case 147 :
placeClip (hmPg2_mc.city_mc,0,-40);
hmPg2_mc.city_mc.gotoAndPlay ("boxIn");
placeClip (hmPg2_mc.ad_mc,152,-40);
placeClip (hmPg2_mc.web_mc,264,-40);
placeClip (hmPg2_mc.mar_mc,-264,-40);
placeClip (hmPg2_mc.pr_mc,-152,-40);
updateAfterEvent ();
break;
case 155 :
hmPg2_mc.city_mc.gotoAndPlay ("boxOut");
placeClip (hmPg2_mc.ad_mc,152,-40);
placeClip (hmPg2_mc.web_mc,264,-40);
placeClip (hmPg2_mc.mar_mc,-264,-40);
placeClip (hmPg2_mc.pr_mc,-132,-40);
placeClip (hmPg2_mc.city_mc,0,-40);
updateAfterEvent ();
break;
case 156 :
animScrnOut (hmPg2_mc);
updateAfterEvent ();
break;
case 158 :
animScrnIn (hmPg_mc,315,155,100,100);
updateAfterEvent ();
break;
case 160 :
mostPopDL_mc._visible = true;
mostPopDL_mc.gotoAndPlay (2);
updateAfterEvent ();
break;
case 161 :
hmPg_mc._visible = false;
updateAfterEvent ();
break;
case 166 :
animScrnOut (mostPopDL_mc);
myVideo_mc.alphaTo (0,(animSpeed * 2),animType);
updateAfterEvent ();
break;
case 167 :
myVideo_mc._x = 405;
myVideo_mc._y = 155;
myVideo_mc.alphaTo (100,(animSpeed * 2),animType);
updateAfterEvent ();
break;
case 194 :
netStrm.pause ();
netStrm.seek (0);
playback_mc.gotoAndStop ("paused");
playBoolean = false;
myVideo_mc.alphaTo (0,(animSpeed * 2),animType);
cctbLogo_mc._visible = true;
cctbLogo_mc.alphaTo (100,(animSpeed * 2),animType);
updateAfterEvent ();
break;
}
updateAfterEvent ();
}
// Play NetStream
netStrm.play (_root.flvFile);
stop ();
Triggering Flash Events From Imported Text
Let's say you have a textArea component that uses html content loaded from a text file.
Can a hyperlink in the text file send commmands to the flash interface?
A simple example... in the text it has a hyperlink that say "click here to go to Section 2."
Anyway of having that hyperlink call a function from within the parent movie?
Key Listeners Triggering Flash IDE Tools Instead Of SWF Events
During Test Movie in the Flash CS3 authoring environment, some keys are being trapped by Flash iteself and are not getting passed to my SWF. These are any that are assigned to Tools, like S(Ink Bottle), K (Paint Bucket), P (Pen), etc. The Test Movie SWF is the active window and I've clicked within it. Why are my keys getting trapped by Flash and not the SWF? Keys that are not assigned to Tools are working fine in my SWF.
Any help greatly appreciated. Code snippets attached.
SB
Attach Code
import flash.events.KeyboardEvent;
//...
initKeyListeners();
//...
private function initKeyListeners():void
{
trace("[Main] initKeyListeners()");
stage.focus = this;
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
}
private function handleKeyDown(e:KeyboardEvent):void
{
trace("[Main] handleKeyDown("+e.charCode+")");
}
Help Triggering Events By Motion -- Clock Simulation
Hi,
I'm working on an animation with a simulated analog clock. I'm trying to get a seperate movie clip instance to play when the clock points to a certain time.
I have a stop action at the start of the workClip movie clip, and a few lines of AS within the clock1 mc to make the hands turn. Nothing elaborate.
Here's my code so far which sits on the main timeline to control the interaction between clock1 and workClip. If anyone can help me find the trouble, I'd really appreciate it.
Deb
// A value of 0 means its morning, 1 means evening
var ampm:Number = 0;
// If the hour hand (hand2) is pointing down (6:00) then play
if (this.clock1.hand2._rotation==180) {
if (ampm==0) {
this.workClip.gotoAndPlay(2);
ampm=1;
}
else {
this.workClip.gotoAndPlay(86);
ampm=0;
}
}
Triggering An Event From My Object?
I’m missing something here. Could someone give me a quick example on how to create my own addlistner() method for my object so that it can trigger it’s own events?
For example I’d have a class that has its own set of criteria needed before firing an event. Other objects could assign listeners waiting for the event before performing their own functions.
Thanks,
R. Sparrow
Determine Object Triggering An Event?
Hello!
I am having an issue where I am unable to make my script determine which button in my menu is triggering the event (MOUSE_UP). I came pretty close to success by finding the "target" property but its not reliable if I have clips within my button.
If anyone could give me the solution to that problem it would be nice Looked around and couldn't find an answer. Thank you!
The animation is not done yet also.
Code:
package {
import flash.display.*;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.text.TextField;
import flash.text.TextFormat;
public class createMenus extends Sprite {
var i:Number;
var menuArray:Array = new Array("Menu 1", "Menu 2", "Menu 3", "Menu 4", "Menu 5")
var nbMenus:Number = menuArray.length;
static var clip:Number = 1;
public function createMenus() {
for(i=1;i<=nbMenus;i++)
{
/*CREATE MENU*/
var mc_menu:MovieClip = new MovieClip();
mc_menu.graphics.beginFill(0x000000);
mc_menu.graphics.drawRect(0,i*20,100,15);
mc_menu.graphics.endFill();
mc_menu.name = "menu"+i;
mc_menu.addEventListener(MouseEvent.MOUSE_UP,clickMenu)
function clickMenu(clicked:Event) {
trace(clicked.target.name);
/*Bug is here, if I click on the button it returns me menu1 to 5 depending on which I click (Thats what its supposed to do.) But if I happen to click on the text within that button it returns me the name of the text instance, example "instance9")*/
}
/*TEXT FORMAT*/
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Verdana";
/*TEXT FIELD*/
var txtField:TextField = new TextField();
txtField.textColor = 0xffffff
txtField.text = menuArray[i-1];
txtField.selectable = false;
txtField.setTextFormat(myFormat);
txtField.width = txtField.text.length*9;
txtField.x = mc_menu.x
txtField.x += (mc_menu.width/2) - txtField.width/2;
txtField.y = (i*20) - 2;
/*EVENT*/
mc_menu.timer = new Timer(500,1);
mc_menu.timer.addEventListener(TimerEvent.TIMER,onTick);
mc_menu.timer.start();
addChild(mc_menu);
mc_menu.addChild(txtField);
}
}
public function onTick(myEvent:Event) {
getChildByName("menu"+clip).addEventListener(Event.ENTER_FRAME, moveMenu);
clip++;
}
public function moveMenu(myEvent:Event) {
var targetX:Number = 200;
var speed:Number = 0.1;
for(i=1;i<=nbMenus;i++)
{
//trace(getChildByName("menu"+i).x)
getChildByName("menu"+i).x += (targetX - getChildByName("menu"+i).x)*speed;
}
}
}
}
Combobox-> Xml->menu : Triggering A New Object Stopping The Old Etc...
Hi
I have to following :
- a AS3 file with class description for dealing with sound
- a flash cs3 file for reading out texts : name, product, artists [like id3 tags]
- the flash cs3 file uses the as3 file for creating a visual effect based on the given mp3
[this works great].
But since my as3 is not that good at the moment my question is :
1. How can I populate a xml based combobox in as3 for changing the actual playing mp3.
The actual triggering starts when creating a new object in var form...
2. How can I also readout mp3 id3 tags at the start of the song and using them instead of creating longer xml files etc.. [so would love only to use a mp3 name and flash cs3 reads out the id3 tags from the mp3 within...]
Code so far [working!!!] cs3/as2:
//SpectrumAnalyzer.as - file
//reads out a mp3 and visualize it in a circle form left/right pan and bass effect
// not my own!
Code:
// SpectrumAnalyzer.as
package {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.utils.ByteArray;
import flash.events.*;
public class SpectrumAnalyzer extends Sprite {
// Settings
public var lineThickness:Number = 2;
public var lineColor:Number = 0x993300;
public var circleSize:Number = 75;
public var scaleOnBeat:Number = 1.1; // 110%
public var reactToBeat:Number = 30;
//
public var music:Sound = new Sound;
public var ba:ByteArray = new ByteArray();
public var __width:uint;
public var __height:uint;
function SpectrumAnalyzer(mp3:String, _width:uint, _height:uint) {
__width = _width;
__height = _height;
x = __width/2;
y = __height/2
music.load(new URLRequest(mp3));
music.play(0, 1); // 1 playing one time, 999 endless duhh
addEventListener(Event.ENTER_FRAME, processSound);
}
public function processSound(ev:Event) {
SoundMixer.computeSpectrum(ba, true, 0);
graphics.clear();
graphics.moveTo(0, -circleSize);
graphics.lineStyle(lineThickness, lineColor);
var vol:Number = 0;
for (var i:uint = 0; i <512; i++) {
var lev:Number = ba.readFloat();
vol += lev;
var a:uint = i;
if (i <256) a += 256;
if (i == 256) graphics.moveTo(0, -circleSize);
graphics.lineTo(-Math.sin(i/256*Math.PI)*circleSize*(lev+1), Math.cos(a/256*Math.PI)*circleSize*(lev+1));
}
if (vol> reactToBeat) {
_global.beat = true;
scaleX = scaleY = scaleOnBeat;
} else {
_global.beat = false;
scaleX = scaleY = 1;
}
}
}
}
IN flash cs 3 frame 1: as3 :
[2 text fields used for reading out mp3 name and description via flashvar from php file integrated into a html file containing the embed stuff....
Code:
// spectrum.fla
import com.SpectrumAnalyzer;
import com.testClass;
//trace(_global.beat);
//reading out the flashvar data and plac ein the 2 fields... demos, demop
root.demos.htmlText = "song: "+root.loaderInfo.parameters.song;
root.demop.htmlText = "product: "+root.loaderInfo.parameters.product;
var link:String = root.loaderInfo.parameters.song;
//here the exctual visualisation starts.... BUT!! how can I trigger a new SpectrumAnalyzer //object [with null? and then via an xml based combobox based on flashvars to redirect //flash to the right mp3 [maybe also reading then the id3 tags from mp3]
var visualization:SpectrumAnalyzer = new SpectrumAnalyzer(link, 330, 520);
visualization.x=120;
visualization.y=120;
addChild(visualization);
//de listener
stopme.addEventListener(MouseEvent.CLICK, actie);
//de function actie
function actie(event:MouseEvent):void{
processSound().stop();
}
Update3: menu system works no ok. Stupid that I traced to much info :-( duh That's why I thought that the changin event did not work...
Now next step for me is triggering dynamically new sound object to override the active mp3 object etc : Flashvar gets right xml to load, combobox items linked with directory placed mp3's Now also try to embed id3 info or putting it als an extra xml thing much handier I guess!
Code:
import fl.controls.ComboBox;
import fl.data.DataProvider;
import flash.events.Event;
import flash.events.MouseEvent;
var dp:DataProvider = new DataProvider();
//dp.addItem({label:"item 1a"});
//dp.addItem({label:"item 2a"});
var myComboBox:ComboBox = new ComboBox()
combo.dataProvider = dp;
combo.move(100, 20);
addChild(combo);
var menuItem:MovieClip;// Libraryitem met linkage / class: MenuItem
var xml:XML;
var xmlArray:Array = new Array();
var xmlList:XMLList;
var xmlMenu:URLLoader = new URLLoader();
// inladen xml bestand
xmlMenu.load(new URLRequest("menu.xml"));
// als xml-bestand helemaal is geladen voer functie uit
xmlMenu.addEventListener(Event.COMPLETE, pushToArray);
// deze functie duwt waarden in een array en sorteert deze
function pushToArray(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for (var i:Number = 0; i < xmlList.length(); i++)
{
xmlArray.push(xmlList[i]);
}
//xmlArray.sort();
trace(xmlArray);
buildMenu();
}
// de gesorteerde menuitems worden vervolgens gekoppeld aan een instance van de button genaamd MenuItem
function buildMenu()
{
for (var i:uint = 0; i < xmlArray.length; i++)
{
//var menuItem:MenuItem = new MenuItem();
//menuItem.x = 25;
//menuItem.y = i * 40;
//menuItem.displayText = xmlArray[i]; // setter
//menuItem.tekst.text = menuItem.displayText; // getter
dp.addItem({label:xmlArray[i],data:xmlArray[i]}); // setter
//addChild(menuItem);
//combo.buttonMode = true;
combo.addEventListener(Event.CHANGE, test );
}
}
function test(event:Event):void{
combo.labelFunction = nameLabelFunction;
trace("Selectedt:"+combo.selectedItem.label);
}
function nameLabelFunction(item:Object):String {
//trace(item.label);
return item.label;
}
Flash IDE,event Listener Changes The Triggering Object By His Own Will, Whatta?
Ok.
Here's the interesting thing. When you make a MovieClip (say "MainMovieClip"), and add an Event Listener (lets name it "MainListener") to it, all works as intended. But after you Load an image into it, or even into a special container inside of our MC, the MainListener no longer listens to the MainMovieClip, it refers to [object Loader] instead. Does it suppose to be this way?
Here's a reproduction code (click the rectangle before the image loads and after):
ActionScript Code:
var Container:MovieClip = new MovieClip();
Container.x = Container.y = 50;
Container.addEventListener("click",function(e:MouseEvent){trace("Container: "+e.target);});
addChild(Container);
var Background:Shape = new Shape();
Background.graphics.beginFill(0xCCCCCC);
Background.graphics.drawRect(0,0,200,100);
Background.graphics.endFill();
Container.addChild(Background);
var Image:MovieClip = new MovieClip()
var iLoader:Loader = new Loader();
iLoader.load(new URLRequest("http://concierge.typepad.com/photos/uncategorized/2007/03/26/mercedes_rental_car_greve_in_chiant.jpg"));
Image.addChild(iLoader);
Container.addChild(Image);
P/S code goes to 1st frame in flash IDE, do no use classes with this code, it wont work.
Any ideas, guys?!
Triggering Mouse Events W/o The Mouse
I have a button that triggers some code and I want to trigger that same code for initialization purposes w/o the user having to click the button....how would I programmatically trigger that buttons event?
thx for the help in adv.!
No Object Events In API
Hello,
If you search for Object events (i.e. events that pass objects inside the event itself) you will see many posts suggesting how to make the custom class to pass the information.
My question is this: Why did Adobe not create such an event in the default API? What downside is there to using this method as the main way to pass information between MVC style components? Since they made special events for everything else, and its such a common practice, surely there must be some reason why it wasn't done.
Thanks in Advance.
Object Events
Hello,
If you search for Object events (i.e. events that pass objects inside the event itself) you will see many posts suggesting how to make the custom class to pass the information.
My question is this: Why did Adobe not create such an event in the default API? What downside is there to using this method as the main way to pass information between MVC style components? Since they made special events for everything else, and its such a common practice, surely there must be some reason why it wasn't done.
Thanks in Advance.
Html Background While Flash Object Loads..possible?
Hi guys, to see what im getting at please goto www.ldistudios.com/showcase/index.html and you will notice that before the flash kicks in there is a white space in the center of the screen where the flash object will appear. Is there any way to apply am image to this area while the object initializes so the html page looks seamless.
Appreciate any help you can give thanks.
Chris
Events Object In Mx2004
Hi there,
I use ActionScript v2 and I want to add an event listener to a component instance with this function :
componentInstance.addEventListener(event, listener)
my question is about the event parameter. Where can I find the availables events type to use? The only example I find about this :
lo = new Object();
lo.click = function(evt){
if (evt.target == button1){
trace("button 1 clicked");
} else if (evt.target == button2){
trace("button 2 clicked");
}
}
button1.addEventListener("click", lo);
button2.addEventListener("click", lo);
.... in this case the event is "click". if by example I want to have a drag event, what is the correct type syntax?
sorry about my bad english
Thanks in advance
Return Name Of Object With Listener Events?
Hi,
I'm trying to return the name of a nested movie clip with an onMouseDown listener.
The start of the code looks like this:
Code:
var listenerObj:Object = new Object();
listenerObj.onMouseDown = function(whichClip) {
// get the name of the nested clip
switch (whichClip) {
case ("optionA") :
someFunction("optionA");
break;
case ("optionB") :
someFunction("optionB");
break;
};
Mouse.addListener(listenerObj);
the result should be of the form "parent.child", after which I will split the two names to fire off different functions. The reason is that I plan to use each part as a variable.
You see I'm trying to use a switch statement, also.
So, here's what I would like to do - have the mouse listener identify which object it is over when clicked.
thanks for any help or insight you can provide!
Best Way To Call Events In Sound Object
I am playing a series of sound files via actionscript 3.0, and I would like to have a fade out effect for each sound and then have the next sound fade in.
I was just curious if anyone could think of a better method then to have an enterframe listener check every frame the position of the song? Or would a timer be better suitable?
Or maybe something else all together? I'm just afraid that the listeners will mess up if a user's machine locks up...
Thanks,
-Danny
Flash Object That Dynamicly Loads Images From A Folder On My Web Server
Want to dynamicly load images from a folder on our web server. I am a senior programmer specializing in asp.net/c#/sql and I can prolly hold my own in Cold Fusion. What I need to do is get a list of files on the server side, pass the list into the flash object, then load the first image, fade it out and fade in the next image. Keep doing that until im out off images, and then start over. Im not good at Flash by all means, but im sure I can figure it out with some help. If anyone could help out that would be great! You can email me at brian@flutterbystudios.org or post on here..
I want to have a folder on my web server with images in it. IE. 1.jpg, 2.jpg. 3.jpg. I want the flash object to be able to get a list of the images and use those images. So if I add or remove an image, I dont have to rebuild the flash object. I know im somehow on the server side going to have to build the list of images since the flash object is a client site thing, but I dont have a problem writing server side code to hand a list of URL's with the images in it to the flash object. Im just not sure how to get the flash object to do what I want it to do.
Thanks in advance!
Brian D. Danford
FlutterBy Studios
How To Add ENTER_FRAME Events To A Class That Is Not A Display Object?
I have a class that manages a group of movie clips. This class is not a display object, but i want it to receive ENTER_FRAME so it can update the objects it manages.
I try to add a listener but I get the error Call to a possibly undefined method addEventListener. I Assume this is because the object is not a display object.
How To Control Mouse Events When Object Is Resizing
I have some Movieclips that play sounds on mouse over, and end the sound on mouse out. That has worked fine for me.
I just implemented some tween animations on the rollover (they enlarge), but now I am having problems because the animations cause multiple mouse over/out events.
Is there an easy way to handle this?
You guys are awesome. Thanks for the help.
Object Communication , Methods,events,broadcasters,dispatchers.. My Ever Static Probs
Hello Gary,
I am not completly clear about object coomunication.
Would it be possible for an object from a private class to communicate via methods calling with another object
also to be instantiated from a private class?
Please explain.
Actually, what does the private modifier does regarding classes?
Can I have communication between static classes?
Where can I learn more about object communication in As?
Another thing: why does the Singleton uses the static modifier? Every instance of the SingletonClass will
hold the same for that static holder, but if there is never more than one instance of it why do we need it
to be hold the same for every possible instance.
Also, what could be the use of using the private modifier for a class? What could a private class be used for?
What about a private static class?
please explain and clarify me and us all.
Thanks,
Daniel Alexandre
ps. It would be great if one Guru out there could do a tutorial or/and a video on the subject. The Flash community would thank you!
External Movie Loads, But The Dynamic Text That Loads With It Won't Render HTML?
I have a set of SWFs that load when a button is pressed on the parent SWF file...they all load into an empty placeholder, and each contains it own dynamic text field. the problem i'm having is, the text loads, but the HTML won't render, so i get plain text and html tags
the script in my external SWF files is as follow.
var lv = new LoadVars;
lv._parent = this;
lv.onLoad=function(success){
if(success)this._parent.home.text = this.guide;
}
lv.load("guide.txt");
everything is filled out correctly in the Property menu, someone PLEASE help
2 QUESTIONS: 1)get Internet Browser 2)htmltext Loads After Image Loads
1) is it possible to check whether the user is using internet explorer, or firefox, opera, etc. /retrieve the browser info?
2) how can i tell a text to load once it's html text has loaded. as in if it had an image tag in the htmlText, and i want the text to size itself [_width = textWidth] but it will do it too early, and i need it to function when the htmlText is loaded.
EDIT: i made a button to go to the second frame when clicked, and the second frame would resize the text. so i clicked it once the image loaded. however the text still went to like 1x1. so it doesnt register an image as text..obviously..soo..how could i make it size itself to the image.
Load Movie By Number 1.swf Loads 2.swf Loads 3.swf
hey everybody,
i have a main movie in which i load an externel "1.swf". i've got plenty of swf's to load (2.swf, 3.swf, 4.swf and so on) how can i make a link in 1.swf which automatically loads 2.swf.
i don't want to specify load 2.swf - i want it to load mynumber+1.swf (i think you get the idea). so that i don't have to make every link. i want 1 code for all.
thanks for helping me out on this one
MC That Loads Another MC That Loads Another MC, Images Look Pixellated. WHY?
Is there something I can do to prevent this? I unclicked the "anti-alias" button in the properties of the imported image, and also tried making it lossless (png). For some reason the images, when I test the parent MC, still come out pixellated. Here is the hierarchy in case u don't understand where the images are:
Parent SWF (my portfolio) contains "container"
|
Loads MC (printwork.swf) into it
|
printwork.swf has a "container"
for loading external swfs
|
brochure1.swf is loaded
into the "container" on
printwork.swf.
The image brochure1 comes out very pixellated....anyone know why>???
Register Classes - Mc Events Vs Button Events
I'm experimenting with register classes today, and wasn't careful typing the code with only button events for my custom movie clip class.
First I wrote
Code:
CustomClass.prototype.onMouseDown = function(){
this.gotoAndStop("blue");
}// end onMouseDown
Then all the mc-buttons in my movie went to the blue state. (.fla provided)
When I realised the error, I corrected it, and now it works.
I just don't understand what happened.
Do Movie Clip events turn out to be class methods (don't know what to call it in Java script, only used to Java), while button events stay instance events??
Hope somebody have the time - it's not about life and death, but it would be really nice to know how these things work.
Triggering An EXE
I have a project in which the client wants to click on a button and have it run an exe file. If I link to it directly, it just tries to download it through a browser. Is there a way to just run the file?
Triggering A MC To Stay Still Or Wonder Off
I have an MC that follows my mouse trail. Within this MC is a button and another MC. Whenever I click on this MC, I want it to stop dead at _y = 20. If I click on it a 2nd time, it will return back to normal following my mouse again. How to do that? Thanks in advance.
Triggering MC Movements
Is there a way to move mc's around with actionscript.
What i want to do is click on a button and that triggers a movie clip that i use as a button to move to a specific location. Like it was sliding around. See link below...
http://www.ibrake4storms.com/color2.swf
http://www.ibrake4storms.com/color2.fla
as you can see the mc moves to a nother location, but it doesn't slide there.
Triggering Preloaders
hi | i have a shell movie which calls several sub movies (external movies) via a blank movie (placeholder.loadMovie('external_movie.swf'); that are triggered by nav buttons.
a friend of mine gave me a preloader to use for the loading of the shell and the subsequent loading of all the submovies -- but i can't get it to work.
i was hoping to post their code here and have someone either help me in trying to figure it out or point out a different way for me to go about this. any help would be greatly appreciated. sorry in advance for the long email -- thanks! - matt.
this code is attached to the preloader movie clip:
onClipEvent (load) {
baseObj = _parent.baseObj;
function doLoaded(movieObj) {
num = movieObj._name;
moviesLoaded++;
loadOrder += num + " ";
}
function loadMov(num) {
duplicateMovieClip (blank, num, num);
loadMovie(eval("baseObj.movie" + num), num);
}
function forceloadMov() {
for (i = 1; i <= numMovies; i++) {
if (loadOrder.indexOf(i + " ") == -1) {
errorNum += i + " ";
unloadMovie(i);
loadMov(i);
return;
}
}
}
pctLoaded = 0;
moviesLoaded = 0;
errorNum = "";
loadOrder = "";
textScaled = false;
loadCutoff = (typeof baseObj.loadCutoff == "string" || typeof baseObj.loadCutoff == "number") ? parseInt(baseObj.loadCutoff) : 3000;
numMovies = (typeof baseObj.numMovies == "string" || typeof baseObj.numMovies == "number") ? parseInt(baseObj.numMovies) : 0;
if (numMovies > 0) {
for (i = 1; i <= numMovies; i++) {
loadMov(i);
}
}
timeStart = new Date();
_parent.stop();
stop();
}
onClipEvent (enterFrame) {
prevSizeLoaded = sizeLoaded;
sizeLoaded = baseObj.getBytesLoaded();
sizeTotal = baseObj.getBytesTotal();
for (i = 1; i <= numMovies; i++) {
sizeLoaded += this[i].getBytesLoaded();
sizeTotal += this[i].getBytesTotal();
}
if (typeof baseObj.totalSize == "string" || typeof baseObj.totalSize == "number") sizeTotal = parseInt(baseObj.totalSize);
if (prevSizeLoaded != sizeLoaded)
timeStart = new Date();
timeElapsed = new Date() - timeStart;
if (timeElapsed > loadCutoff) {
forceloadMov();
timeStart = new Date();
}
play();
/*pctLoaded = Math.floor(sizeLoaded / sizeTotal * 100);
gotoAndStop(pctLoaded + 1);*/
if (!textScaled) {
textScaled = true;
t1._xscale = t2._xscale = 100 / this._xscale * 100;
t1._yscale = t2._yscale = 100 / this._yscale * 100;
}
if (baseObj.getBytesLoaded() >= baseObj.getBytesTotal() && moviesLoaded >= numMovies && _root.main[baseObj._name + "Loaded"]) {
this._visible = false;
_parent.play();
}
}
okay. i'm thinking that obviously i don't need all this code. what i really think is that i need some way to simply pass the particular movie the user clicked to load (baseObj) via the nav button(i.e. about, contact, etc..)to the preloader function.
then the preloader will know which external movie (submovie) it has to read the bytes on. in the example above he uses a baseObj. so, i was thinking along the lines of:
on the trigger nav button:
on(release) {
baseObj = contact;
preloader.gotoAndPlay(2);
placeholder.loadMovie("contact.swf");
}
onClipEvent(enterFrame) {
baseObj = _root.baseObj;
}
then something like:
if (baseObj.getBytesLoaded() == baseObj.getBytesTotal()){
this._visible = false;
_parent.play();
}
}
ok, i don't have it right in all places, but i think i have some of the major pieces. again, sorry for the length of this email. any helpful suggestions would be greatly appreciated.
matt!
Triggering One File With Another
Hi all, I have an instance where I have two separate swf's on a single page in different areas and would like swf1 to play in say the left side of the page and upon completion then tell the swf2 to play on the right side of the page but keep both on the same page.
Any direction would be appreciated.
Re-triggering A Progress Bar
Hi there. I have a progress bar that has a scroll pane as it's source with the mode set to polled. Now, I have a menu in the movie that changes the content of the scroll pane. When the page is initially loaded, the Progress Bar correctly shows the initial swf in the Scroll Pane being downloaded. However, on subsequent calls to my_scrollPane.contentPath = newContent when menu options are clicked, the Progress Bar just stays at 100% even though the Scroll Pane is downloading new content. I'm really stumped as to how to rectify this. I assumed that, whenever I use my_scrollPane.contentPath = newContent, the Scroll Pane will fire a progress event which will cause the Progress Bar to reset to 0 and correctly show the new content downloading. You can view the page <a href="http://www-jcsu.jesus.cam.ac.uk/~oa207/pages/home.htm">here</a>. Click on "My Eyes" in the nav bar at the top. The relevant code is posted below. Thanks in advance.
// thumbPane is the scroll pane
// the source and mode of the progress bar have been set using the property inspector
/* Scroll Pane Listeners */
spListener = new Object();
spListener.owner = this;
spListener.load = function(eventObject) {
this.owner.thumbPane.contentPath = "florafauna_thumbs.swf";
this.owner.thumbPane.setStyle("backgroundColor", "black");
this.owner.thumbPane.setStyle("themeColor",0xA6DFF D);
}
spListener.complete = function(eventObject) {
this.owner.gotoAndPlay(5); // Frame 5 contains code to check that certain variables have been loaded into memory, and swonks until they have
}
thumbPane.addEventListener("load",spListener);
thumbPane.addEventListener("complete",spListener);
import MenuBarDecorator;
// create a new menu bar decorator instance for myMenuBar
myMenuBarDecorator = new MenuBarDecorator(myMenuBar);
// load the menu structure into our decorated menu bar
myMenuBarDecorator.loadMenuStructure("xml/menubar.xml",this);
// listeners
var natureMenuListener = new Object();
natureMenuListener.owner = this;
natureMenuListener.change = function(eventObject) {
var theMenu = eventObject.menu;
var theMenuItem = eventObject.menuItem;
var thumbnailFile:String = String(theMenuItem.attributes.instanceName)+"_thum bs.swf";
this.owner.setThumbPaneContent(thumbnailFile);
}
Triggering Movieclips
ok.
I am making an animated banner for my friends' site. in this animation i have some nested movie clips, called "Buttons" and "Buttons1", with "Buttons1" nested inside "Buttons". (these are just mc's, no real buttons involved.)(hope that makes sense)
what i want to happen is this :
The animation in "Buttons1" plays automatically when the page that the final swf will be on finishes loading it. when "Buttons1" is finished, it will stop, and at the same time trigger "Buttons" to play. when the animation in "Buttons" has played once, it will trigger the main timeline, and continue to loop.
At the moment, all that happens is the animation in "Buttons" loops.
i was thinking of using AS, but i wasn't sure, so i decided to post the thread in here.
thanks in advance for any help,
The_lone1.
Flv OnStatus Not Triggering
Hi
I have written a bit of script which should stop at an MCs frame when Playback has stopped but it doesn't, can anyone help?
Code:
ns.onStatus = function(vidInfo:Object) {
var netStreamStatus = vidInfo.code;
if (netStreamStatus == "NetStream.Play.Stop") {
the_menu.main_container_.main_item_0.btnGrn.gotoAndStop("off");//heres the path and switching MC off does not work
trace("Video Complete");
}
};
Triggering A Button
When creating a Sprite, adding two children - a SimpleButton & a TextField served as the label,
When mouseovering this sprite if the mouse pointer is on the top of the TextField instance area,
the button's rollover state won't trigger.
I tried to turn off the TextField's selectable property, but with no vail.
How can I make this happen?
PHP Code:
var menubar = new Sprite();var button = new SimpleButton();var label = new TextField();menubar.addChild(button);menubar.addChild(label);addChild(menubar);
I avoid using the deefault Flash UI Button 'cuz it's too big.
OnHTTPError Is Not Triggering
I wonder why onHTTPError is not triggering?
I am using standard uploading routine (FileReference) + php... so problem is if I am trying to send headers like header("HTTP/1.1 404 Not Found"), "onHTTPError" event is not triggering... only thing I get is "onProgress" event...... "onComplete","onHTTPError" or other events not called in the listener...
btw other things working, files are uploading to server and so on, but I need to make some checks and in some cases have to send errors.
Triggering On (press)
Is there any way to trigger the on (press) of a button when it hasn't actually been pressed? What I'm doing exactly is making it so that when you click on button1 it creates button 2, and starts button 2 being dragged. In button 2 it has on (press) startDrag(this, true), and on (release) stopDrag(). The problem is when you click on button 1, it creates button2 and starts the drag, but when you release button2 it doesn't stop the drag because it was never originally pressed...
Triggering Something In The Movie?
I wonder if its possible to trigger something in a flash dokument from a external link.
For example
I just want a play and stop button in my html page to trigger the swf to play and stop.?
|