XML Banner Rotator in flash
XML Code file Slider.xml
<?xml version="1.0" encoding="utf-8"?>
<slide DELAY="2">
<image URL="SliderImages/1.jpg" links="http://www.link1.com" />
<image URL="SliderImages/2.jpg" links="http://www.link2.com" />
</slide>
Here is my actionScript3 Code.
function Complete(e:Event):void {
var _xml:XML=new XML(e.target.data);
_loader.removeEventListener(Event.COMPLETE, Complete);
_loader=null;
_delay=_xml.@DELAY;
_images=_xml.image;
_total=_images.length();
LoadImages();
}
function LoadImages():void {
for (var i:int = 0; i < _total; i++) {
var _url:String=_images[i].@URL;
_linked=_images[i].@links;
var _loader:Loader = new Loader();
_loader.load(new URLRequest(_url));
my_link.push(_linked);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ImageLoaded);
_loaders.push(_loader);
_loader.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
}
}
function fl_ClickToGoToWebPage(event:MouseEvent):void {
navigateToURL(new URLRequest(_linked));
}
My code is working fine, but the Hyper link is not working correctly.
How can I add hyper link in the loop so navigateToURL
user starts to work?
actionscript-3 flash-cc
add a comment |
XML Code file Slider.xml
<?xml version="1.0" encoding="utf-8"?>
<slide DELAY="2">
<image URL="SliderImages/1.jpg" links="http://www.link1.com" />
<image URL="SliderImages/2.jpg" links="http://www.link2.com" />
</slide>
Here is my actionScript3 Code.
function Complete(e:Event):void {
var _xml:XML=new XML(e.target.data);
_loader.removeEventListener(Event.COMPLETE, Complete);
_loader=null;
_delay=_xml.@DELAY;
_images=_xml.image;
_total=_images.length();
LoadImages();
}
function LoadImages():void {
for (var i:int = 0; i < _total; i++) {
var _url:String=_images[i].@URL;
_linked=_images[i].@links;
var _loader:Loader = new Loader();
_loader.load(new URLRequest(_url));
my_link.push(_linked);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ImageLoaded);
_loaders.push(_loader);
_loader.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
}
}
function fl_ClickToGoToWebPage(event:MouseEvent):void {
navigateToURL(new URLRequest(_linked));
}
My code is working fine, but the Hyper link is not working correctly.
How can I add hyper link in the loop so navigateToURL
user starts to work?
actionscript-3 flash-cc
The _linked variable is all alone and cannot possibly contain all the links at once. It holds only the last one assigned. You should think in OOP way: create a component that takes the initialization data (image URL and link, or the whole XML node, whatever) then load the image and act like a button to navigate to the link on click. Then, you create as many instances of that component as your whole XML dictates, passing each it's own node. Thus you'll get a bunch of different buttons each holding it's own image and it's own link.
– Organis
Dec 27 '18 at 19:50
Here is all code. But how to add link can some one help to see this code codescratcher.com/flash/simple-xml-banner-rotator-flash
– Naser Sultan
Dec 27 '18 at 20:33
That's not how it is going to work. As I said above, you need to learn OOP principles and component approach to coding first.
– Organis
Dec 27 '18 at 20:56
i started to learn OOP objected oriented principles and component approach but any one answer the code for my question he will be appreciate and thank
– Naser Sultan
Dec 28 '18 at 19:05
add a comment |
XML Code file Slider.xml
<?xml version="1.0" encoding="utf-8"?>
<slide DELAY="2">
<image URL="SliderImages/1.jpg" links="http://www.link1.com" />
<image URL="SliderImages/2.jpg" links="http://www.link2.com" />
</slide>
Here is my actionScript3 Code.
function Complete(e:Event):void {
var _xml:XML=new XML(e.target.data);
_loader.removeEventListener(Event.COMPLETE, Complete);
_loader=null;
_delay=_xml.@DELAY;
_images=_xml.image;
_total=_images.length();
LoadImages();
}
function LoadImages():void {
for (var i:int = 0; i < _total; i++) {
var _url:String=_images[i].@URL;
_linked=_images[i].@links;
var _loader:Loader = new Loader();
_loader.load(new URLRequest(_url));
my_link.push(_linked);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ImageLoaded);
_loaders.push(_loader);
_loader.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
}
}
function fl_ClickToGoToWebPage(event:MouseEvent):void {
navigateToURL(new URLRequest(_linked));
}
My code is working fine, but the Hyper link is not working correctly.
How can I add hyper link in the loop so navigateToURL
user starts to work?
actionscript-3 flash-cc
XML Code file Slider.xml
<?xml version="1.0" encoding="utf-8"?>
<slide DELAY="2">
<image URL="SliderImages/1.jpg" links="http://www.link1.com" />
<image URL="SliderImages/2.jpg" links="http://www.link2.com" />
</slide>
Here is my actionScript3 Code.
function Complete(e:Event):void {
var _xml:XML=new XML(e.target.data);
_loader.removeEventListener(Event.COMPLETE, Complete);
_loader=null;
_delay=_xml.@DELAY;
_images=_xml.image;
_total=_images.length();
LoadImages();
}
function LoadImages():void {
for (var i:int = 0; i < _total; i++) {
var _url:String=_images[i].@URL;
_linked=_images[i].@links;
var _loader:Loader = new Loader();
_loader.load(new URLRequest(_url));
my_link.push(_linked);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ImageLoaded);
_loaders.push(_loader);
_loader.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
}
}
function fl_ClickToGoToWebPage(event:MouseEvent):void {
navigateToURL(new URLRequest(_linked));
}
My code is working fine, but the Hyper link is not working correctly.
How can I add hyper link in the loop so navigateToURL
user starts to work?
actionscript-3 flash-cc
actionscript-3 flash-cc
edited Dec 27 '18 at 18:11
trincot
118k1481112
118k1481112
asked Dec 27 '18 at 16:35
Naser Sultan
11
11
The _linked variable is all alone and cannot possibly contain all the links at once. It holds only the last one assigned. You should think in OOP way: create a component that takes the initialization data (image URL and link, or the whole XML node, whatever) then load the image and act like a button to navigate to the link on click. Then, you create as many instances of that component as your whole XML dictates, passing each it's own node. Thus you'll get a bunch of different buttons each holding it's own image and it's own link.
– Organis
Dec 27 '18 at 19:50
Here is all code. But how to add link can some one help to see this code codescratcher.com/flash/simple-xml-banner-rotator-flash
– Naser Sultan
Dec 27 '18 at 20:33
That's not how it is going to work. As I said above, you need to learn OOP principles and component approach to coding first.
– Organis
Dec 27 '18 at 20:56
i started to learn OOP objected oriented principles and component approach but any one answer the code for my question he will be appreciate and thank
– Naser Sultan
Dec 28 '18 at 19:05
add a comment |
The _linked variable is all alone and cannot possibly contain all the links at once. It holds only the last one assigned. You should think in OOP way: create a component that takes the initialization data (image URL and link, or the whole XML node, whatever) then load the image and act like a button to navigate to the link on click. Then, you create as many instances of that component as your whole XML dictates, passing each it's own node. Thus you'll get a bunch of different buttons each holding it's own image and it's own link.
– Organis
Dec 27 '18 at 19:50
Here is all code. But how to add link can some one help to see this code codescratcher.com/flash/simple-xml-banner-rotator-flash
– Naser Sultan
Dec 27 '18 at 20:33
That's not how it is going to work. As I said above, you need to learn OOP principles and component approach to coding first.
– Organis
Dec 27 '18 at 20:56
i started to learn OOP objected oriented principles and component approach but any one answer the code for my question he will be appreciate and thank
– Naser Sultan
Dec 28 '18 at 19:05
The _linked variable is all alone and cannot possibly contain all the links at once. It holds only the last one assigned. You should think in OOP way: create a component that takes the initialization data (image URL and link, or the whole XML node, whatever) then load the image and act like a button to navigate to the link on click. Then, you create as many instances of that component as your whole XML dictates, passing each it's own node. Thus you'll get a bunch of different buttons each holding it's own image and it's own link.
– Organis
Dec 27 '18 at 19:50
The _linked variable is all alone and cannot possibly contain all the links at once. It holds only the last one assigned. You should think in OOP way: create a component that takes the initialization data (image URL and link, or the whole XML node, whatever) then load the image and act like a button to navigate to the link on click. Then, you create as many instances of that component as your whole XML dictates, passing each it's own node. Thus you'll get a bunch of different buttons each holding it's own image and it's own link.
– Organis
Dec 27 '18 at 19:50
Here is all code. But how to add link can some one help to see this code codescratcher.com/flash/simple-xml-banner-rotator-flash
– Naser Sultan
Dec 27 '18 at 20:33
Here is all code. But how to add link can some one help to see this code codescratcher.com/flash/simple-xml-banner-rotator-flash
– Naser Sultan
Dec 27 '18 at 20:33
That's not how it is going to work. As I said above, you need to learn OOP principles and component approach to coding first.
– Organis
Dec 27 '18 at 20:56
That's not how it is going to work. As I said above, you need to learn OOP principles and component approach to coding first.
– Organis
Dec 27 '18 at 20:56
i started to learn OOP objected oriented principles and component approach but any one answer the code for my question he will be appreciate and thank
– Naser Sultan
Dec 28 '18 at 19:05
i started to learn OOP objected oriented principles and component approach but any one answer the code for my question he will be appreciate and thank
– Naser Sultan
Dec 28 '18 at 19:05
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53948118%2fxml-banner-rotator-in-flash%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53948118%2fxml-banner-rotator-in-flash%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The _linked variable is all alone and cannot possibly contain all the links at once. It holds only the last one assigned. You should think in OOP way: create a component that takes the initialization data (image URL and link, or the whole XML node, whatever) then load the image and act like a button to navigate to the link on click. Then, you create as many instances of that component as your whole XML dictates, passing each it's own node. Thus you'll get a bunch of different buttons each holding it's own image and it's own link.
– Organis
Dec 27 '18 at 19:50
Here is all code. But how to add link can some one help to see this code codescratcher.com/flash/simple-xml-banner-rotator-flash
– Naser Sultan
Dec 27 '18 at 20:33
That's not how it is going to work. As I said above, you need to learn OOP principles and component approach to coding first.
– Organis
Dec 27 '18 at 20:56
i started to learn OOP objected oriented principles and component approach but any one answer the code for my question he will be appreciate and thank
– Naser Sultan
Dec 28 '18 at 19:05