Copy link to clipboard
Copied
I created an video Flash ad with ActionScript 3.0 and was then told by the publisher I could only use ActionScript 2.0. #smh
I've gone back and tried to figure out the ActionScript 2.0 alternatives and syntax and the ad appears now without any errors but I seem to be missing something as the play_btn will not start the video.
Here's my script:
var myVideo:Video = new Video(300, 170); // note size for video
addChild(myVideo);
// Play button
play_btn.onRelease = function() {
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = new Object();
myVideo.attachVideo(ns);
ns.play("http://www.dcccd.edu/images/DCCCDlogos/flash/welding.flv");
addChild(play_btn);
addChild(stop_btn);
};
// Stop button
stop_btn.onRelease = function() {
ns.pause();
};
// Lean More button
learn_btn.onRelease = function() {
getURL(_root.clickTAG, "_blank");
};
// stop();
I'm not sure if I need the stop command or not as right now it's not making a difference one way or the other. Any help on what I'm missing would be greatly appreciated.
try:
...
var myVideo:Video = new Video(300, 170); // note size for video
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
myVideo.attachVideo(ns);
// Play button
play_btn.onRelease = function() {
ns.play("http://www.dcccd.edu/images/DCCCDlogos/flash/welding.flv");
};
// Stop button
stop_btn.onRelease = function() {
ns.pause();
};
// Lean More button
learn_btn.onRelease = function() {
getURL(_root.clickTAG, "_blank");
};
// stop();
Copy link to clipboard
Copied
try:
var myVideo:Video = new Video(300, 170); // note size for video
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
myVideo.attachVideo(ns);
// Play button
play_btn.onRelease = function() {
ns.play("http://www.dcccd.edu/images/DCCCDlogos/flash/welding.flv");
};
// Stop button
stop_btn.onRelease = function() {
ns.pause();
};
// Lean More button
learn_btn.onRelease = function() {
getURL(_root.clickTAG, "_blank");
};
// stop();
Copy link to clipboard
Copied
That seems to have gotten the video playing again not sure why the order made a difference.
The downside is it's playing in the background apparently so the still graphic isn't being hidden while the video is playing.
I tried re-adding the add_child lines back in but that didn't seem to fix it.
Copy link to clipboard
Copied
your main problem was making netstream and netconnection local to that onrelease function. also, there is no addchild in as2.
to solve your latest problem, convert your bg graphic to a movieclip and assign an instance name. in the onrelease, assign that movieclip's _visible property to false.
p.s. please mark correct and helpful responses.
Copy link to clipboard
Copied
Thanks on the _visible property tip.
It seems I spoke to soon on the video playing correctly. Apparently it's playing because I'm getting audio - but it's no where to be seen on the ad.
I don't know if one of the functions is missing or something else.
Copy link to clipboard
Copied
there is no video constructor in as2. use the code i showed less the new Video line.
add a video symbol to your library, drag it to the stage and assign an instance name of myVideo.
test.
Copy link to clipboard
Copied
Ahhh... guess I should find a reference as to what works in as2 vs as3. I had the video symbol on the stage but it was named my_Video from the previous code.
So much to learn - and yet I'll probably only use this once or twice a year.
Is there any reason you know of why someone would prefer as2 flash over as3?
Seems as3 is far more flexible.
Copy link to clipboard
Copied
none. skip as2.
Copy link to clipboard
Copied
Grrr... that was my plan but the publisher said they had to have it in AS2 otherwise pop-up blockers would block the ad.
Copy link to clipboard
Copied
i use flashblock with ff and it blocks all flash as2 or as3. it's hard to believe any flash blocker would allow as2 and catch as3.