View Full Version : click to open a textbox
camerio
04-12-2006, 04:40 AM
i am rewriting this post, got no answers at all the first time. and i need this project done. i know this is basic actionscript, but I am definetly a beginner, and i cant find anything specific on this.
i need my thumbnails to open 2 texboxes. one for the title of the video, 1 for the desciption of the video playing. the thumbnails already start the videos.
i attached the fla files and you can find an html example here: http://majeeproductions.com/flash/videobox6.html
how can i put a code like this on my thumbnails to load text in textarea (OnClick)?
//Load the text.
var loadit_lv:LoadVars = new LoadVars();
loadit_lv.load("http://majeeproductions.com/flash/txt/txt1.txt");
loadit_lv.onData = function(src:String) { if (src != undefined) {
my_txt.text = src;
} else {
trace("Could not load text file.");
}
};
and a code like that to load text in titlearea (on RollOver):
//Load the text.
var loadit_lv:LoadVars = new LoadVars();
loadit_lv.load("http://majeeproductions.com/flash/txt/title1.txt");
loadit_lv.onData = function(src:String) { if (src != undefined) {
my_titre.text = src;
} else {
trace("Could not load text file.");
}
};
if your thumbnails are each a seperate movie clip you can just put the code within a clip event handler placed on the movie clip
onClipEvent(mouseDown)
{
//Load the text.
var loadit_lv:LoadVars = new LoadVars();
loadit_lv.load("http://majeeproductions.com/flash/txt/txt1.txt");
loadit_lv.onData = function(src:String) {
if (src != undefined) {
_root.my_txt.text = src;
} else {
trace("Could not load text file.");
}
};
}
alternatively you could make your thumbnails buttons objects and then apply the code through on(press) and on(rollOver) handlers.
sorry to be vague. i would have had a look at your fla file but it didn't seem to be attached.
mcmcom
04-12-2006, 05:22 AM
how far has this code of yours gotten, does it call the function?
does it come back with "could not load the text file"
try putting :
trace(src); in the function, right above my_titre.text = src, does the trace function return the string you want?
also can you post an example of the text file your pulling data from?
mcm
camerio
04-13-2006, 12:57 PM
thank you for the answers! i dont feel so alone anymore... :)
the fla file once zip is still too big to download:791 kb. maybe by email? : pierreshapiro@yahoo.ca
the code is working, when i open the page it works. the 2 text boxes open, the videos also work.
here is the link : http://majeeproductions.com/flash/videobox6.html
i just need to put it on the thumbs movie clips
here are the 2 codes on the thumbnails first for text then the video:
on (release) {
loadText = new loadVars();
loadText.load("text1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.myNews;
}
};
}
on (release) {
// Set Video Index Behavior
this._parent.tele1.stop();
this._parent.tele1.activeVideoPlayerIndex = 9;
this._parent.tele1.visibleVideoPlayerIndex = 9;
this._parent.tele1.play();
// End Set Video Index Behavior
}
i attached a copy of the txt file...it is appearing weird in flash beacause the text is in french and i dont seem to be able to embed the e and a with accent.
each thumbnail is a different movie clip.
this code you sent me doesn't open the txtfile, it does nothing to the testbox.:
onClipEvent(mouseDown)
{
//Load the text.
var loadit_lv:LoadVars = new LoadVars();
loadit_lv.load("http://majeeproductions.com/flash/txt/txt1.txt");
loadit_lv.onData = function(src:String) {
if (src != undefined) {
_root.my_txt.text = src;
} else {
trace("Could not load text file.");
}
};
}
i've seen it before. why is it so hard to open a textbox at the same time as a video?
i appreciate all the help. i am suree i am close....
pierre
camerio
04-18-2006, 03:36 PM
this error message appears when i play my flash movie.:
**Warning** Scene=Scene 1, layer=content, frame=1:Line 3: Case-insensitive identifier 'loadVars' will obscure built-in object 'LoadVars'.
loadText = new loadVars();
probably because there is a conflict between the videos and the textboxes, opening from the same movieclip thumbnail? how can i put the action so there is no conflict between the 2 actions?
my thumbnails open the videos (in the FLV component) and also the description about the videos in a dynamic txtbox.
here's the code on the thumbnails, it doesnt open the video, another problem shows in outout:
**Error** Scene=Scene 1, layer=content, frame=1:Line 21: Statement must appear within on/onClipEvent handler
var videos:Object = new Object();:
on (release) {
loadText = new loadVars();
loadText.load("text1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.myNews;
}
};
}
on (release) {
// Set Video Index Behavior
this.tele1.stop();
this.tele1.activeVideoPlayerIndex = 3;
this.tele1.visibleVideoPlayerIndex = 3;
this.tele1.play();
// End Set Video Index Behavior
}
and, here's the code placed on the video flv index, video works fine
:
// Set Videos Behavior
// Create a videos object to hold a video
// playlist and event handler functions...
var videos:Object = new Object();
// Set up to 7 video feeds in a single component
videos.list = new Array();
videos.list = new Array();
videos.list[0] = "video/video-chasse.flv";
videos.list[1] = "video/video-juste.flv";
videos.list[2] = "video/video-meilleur.flv";
videos.list[3] = "video/video-watier.flv";
videos.list[4] = "video/video-unicef.flv";
videos.list[5] = "video/video-militaire.flv";
videos.list[6] = "video/video-travelling.flv";
videos.list[7] = "video/video-yang1.flv";
videos.list[8] = "video/video-yang2.flv";
videos.list[9] = "video/video-pire.flv";
videos.list[10] = "video/video-mimi.flv";
videos.list[11] = "video/video-chasse";
videos.loop = false;
videos.length = 1;
videos.loaded = false;
// Path to FLVPlayback components
var m = this.tele1;
// Set the path of the first video feed
m.contentPath = videos.list[3];
// Set a 'ready' event handler to load the videos
videos.ready = function( evt:Object ):Void
{
if(!this.loaded){
this.loaded = true;
for( var n=1; n<this.list.length; n++ ){
if( videos.list[n].indexOf(".flv") != -1 ){
m.activeVideoPlayerIndex = n;
m.contentPath = videos.list[n];
this.length++;
}
}
m.activeVideoPlayerIndex = 3;
}
}
m.addEventListener("ready",videos);
// Set a 'complete' event handler to load the next video
videos.complete = function( evt:Object ):Void
{
var nextIndex = Number(evt.vp)+0;
if( nextIndex == this.length){
if( this.loop ){
nextIndex = 0;
}else{
return;
}
}
m.activeVideoPlayerIndex = nextIndex;
m.visibleVideoPlayerIndex = nextIndex;
m.play();
}
m.addEventListener("complete",videos);
thanks for the help.
here a version where the video works.http://majeeproductions.com/flash/videobox1.html
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.