Toon posts:

Flash: loading external file

Pagina: 1
Acties:
  • 114 views sinds 30-01-2008
  • Reageer

Verwijderd

Topicstarter
Matched: loadvars
Beste mensen,

ik heb hier een werkende .as file die ik include:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Create a new style sheet and LoadVars object
var myVars:LoadVars = new LoadVars();
var styles = new TextField.StyleSheet();
// Location of CSS and text files to load
var txt_url = "bulk.html";
var css_url = "css.css";
// Load text to display and define onLoad handler
myVars.load(txt_url);
myVars.onData = function(content) {
    storyText = content;
};
// Load CSS file and define onLoad handler:
styles.load(css_url);
styles.onLoad = function(ok) {
    if (ok) {
        // If the style sheet loaded without error, 
        // then assign it to the text object, 
        // and assign the HTML text to the text field.
        content.bulk.styleSheet = styles;
        content.bulk.text = storyText;
    }
};


Nou wil ik graag de css en de html file die ik inlaad ergens anders neerzetten dan in de
direkte map van de betreffende .swf > nou dacht ik zo:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Create a new style sheet and LoadVars object
var myVars:LoadVars = new LoadVars();
var styles = new TextField.StyleSheet();
// Location of CSS and text files to load
var txt_url = "./content/bulk.html"; > of bv ook "www.mijnsite.nl/pagina.html"
var css_url = "./css/css.css"; > of bv ook "www.mijnsite.nl/css.css"
// Load text to display and define onLoad handler
myVars.load(txt_url);
myVars.onData = function(content) {
    storyText = content;
};
// Load CSS file and define onLoad handler:
styles.load(css_url);
styles.onLoad = function(ok) {
    if (ok) {
        // If the style sheet loaded without error, 
        // then assign it to the text object, 
        // and assign the HTML text to the text field.
        content.bulk.styleSheet = styles;
        content.bulk.text = storyText;
    }
};


maar dit werkt helaas op geen enkele manier...

Hoop dat jullie me kunnen verder helpen.... _/-\o_

  • XangadiX
  • Registratie: Oktober 2000
  • Laatst online: 13-05 10:26

XangadiX

trepanatie is zóó kinderachtig

Geen matches
paden moet je relatief maken van waar je de swf aanroept, niet vanaf waar je de swf hebt staan

dus als je swf in http://mijndomijn.nl/images/flash/swf/loader.swf staat

maar je gebruikt hem op http://mijndomijn.nl/index.html

en de swf gebruikt plaatjes uit http://mijndomijn.nl/images/ploatjes/


dan moeten de paden in de swf "images/ploatjes" zijn en niet "../../ploatjes"

Stoer; Marduq


Verwijderd

Topicstarter
Geen matches
JA !!!

dit werkt maar hoe doe ik dat met bv een css of html file die online staan ?

en

kan ik ook gewoon gegenereerde tekst door een php bestand inladen ?
dus bv php_textloader.php, die tekst uit een database haald in combinatie met een css.. :?

  • XangadiX
  • Registratie: Oktober 2000
  • Laatst online: 13-05 10:26

XangadiX

trepanatie is zóó kinderachtig

Geen matches
over css heb ik je al een link gegeven: Flash en css...

php is simpel eigenlijk (als je het even weet ;) )

als je php bestand flash vars terug geeft
code:
1
var1=foo&var2=bar


kun je hem inladen als textbestand ( loadvariables(somefile.php, 0) ), wat je wel even moet doen met php is achteraan de string een variable zetten als 'received=1' of 'totalvars=10', in flash laat je dan een functie meelopen die checked of alles binnen is (het gebeurt nog wel eens dat er maar de helft binnenkomt namelijk)

iets als

code:
1
2
3
4
5
6
7
8
9
10
_root.loadvariables("myphp.php") //met als laatste var 'allreceived=1'

checker = setInterval (checkPHP, 100)

function checkPHP() {
 if (allreceived == 1) {
  clearinterval(checker)
   //statements
 }
}


er is overigens een open source, php based flash communication server achtig ding, hier te vinden http://www.amfphp.org/

Stoer; Marduq